⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex19 - theremin.bs2

📁 proteus得一些经典例子
💻 BS2
字号:
' {$STAMP BS2}
' ==============================================================================
'
' File...... Ex19 - Theremin.BS2
' Purpose... Simple Digital Theremin
' Author.... Parallax
' E-mail.... stamptech@parallaxinc.com
' Started...
' Updated... 01 MAY 2002
'
'
' ==============================================================================
' ------------------------------------------------------------------------------
' Program Description
' ------------------------------------------------------------------------------
' This program uses RCTIME with a photocell to create a light-controlled
' theremin.
' ------------------------------------------------------------------------------
' I/O Definitions
' ------------------------------------------------------------------------------
Speaker CON 0 ' piezo speaker output
PitchCtrl CON 1 ' pitch control (RCTIME) input
' ------------------------------------------------------------------------------
' Constants
' ------------------------------------------------------------------------------
Scale CON $0100 ' divider for BS2/BS2e
'Scale CON $0066 ' divider for BS2sx
'Scale CON $0073 ' divider for BS2p
Threshold CON 200 ' cutoff frequency to play
' ------------------------------------------------------------------------------
' Variables
' ------------------------------------------------------------------------------
tone VAR Word ' frequency output
' ------------------------------------------------------------------------------
' Program Code
' ------------------------------------------------------------------------------
Main:
HIGH PitchCtrl ' discharge cap
PAUSE 1 ' for 1 ms
RCTIME PitchCtrl, 1, tone ' read the light sensor
tone = tone */ Scale ' scale input
IF (tone < Threshold) THEN Main ' skip for ambient light
FREQOUT Speaker, 25, tone ' output the tone
GOTO Main
END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -