27297 Parallax Inc, 27297 Datasheet - Page 120

KIT STAMPWORKS WITH BS2-IC

27297

Manufacturer Part Number
27297
Description
KIT STAMPWORKS WITH BS2-IC
Manufacturer
Parallax Inc
Datasheet

Specifications of 27297

Lead Free Status
Contains lead
Product
Microcontroller Accessories
Lead Free Status / Rohs Status
Lead free / RoHS Compliant

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
27297SQ
Manufacturer:
NS
Quantity:
4
' -----[ Constants ]-------------------------------------------------------
TAdj
FAdj
Threshold
NoteTm
' -----[ Variables ]-------------------------------------------------------
tone
' -----[ Program Code ]----------------------------------------------------
Main:
Behind the Scenes
A Theremin is an interesting musical device used to create those weird, haunting
sounds often heard in old horror movies. This version uses the light falling onto a
photocell to create the output tone.
Since the photocell is a resistive device, RCTIME can be used to read its value.
FREQOUT is used to play the note. The constant, Threshold, is used to control the
cutoff point of the Theremin. When the photocell reading falls below this value, no
sound is played. This value should be adjusted to the point where the Theremin
stops playing when the photocell is not covered in ambient light.
Behind the Scenes…Going Deeper
You may wonder how the BASIC Stamp is able to create a musical note using a pure
digital output. The truth is that it gets a little help from the outside world. At the
DO
LOOP
HIGH PitchCtrl
PAUSE 1
RCTIME PitchCtrl, 1, tone
tone = tone */ FAdj
IF (tone > Threshold) THEN
ENDIF
FREQOUT Speaker, NoteTm */ TAdj, tone
CON
CON
CON
CON
VAR
$100
$100
200
40
Word
' time adjust factor
' frequency adjust factor
' cutoff frequency to play
' note timing
' frequency output
' discharge cap
' for 1 ms
' read the light sensor
' scale input
' play?

Related parts for 27297