28129 Parallax Inc, 28129 Datasheet - Page 156

TEXT BASIC ANALOG & DIGITAL

28129

Manufacturer Part Number
28129
Description
TEXT BASIC ANALOG & DIGITAL
Manufacturer
Parallax Inc
Type
Programmingr
Datasheet

Specifications of 28129

Style
Book
Title
Basic Analog and Digital
Contents
Basic Analog and Digital Text
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
Then
Program It
Enter Program 8.1 in your BASIC Stamp Editor, and download to the BASIC Stamp.
' Basic Analog and Digital - PL8_1R0.bs2
' Program Listing 8.1 Revision 0.
' {$STAMP BS2}
' {$PBASIC 2.5}
light
dischargeTime
sound
a
DO
LOOP
The Output
The piezoelectric speaker should beep every half second or so. If you put your hand over
the circuit to shade it, the tone of the beep should get lower. If you face your breadboard
directly at a light in the room, the pitch should get higher. Figure 8-5 a sample output for
a well-lit room.
HIGH 15
PAUSE 100
RCTIME 15, 1, light
dischargeTime = light * 2
sound = (65535 - light) / a
FREQOUT 7, 500, sound
DEBUG HOME
DEBUG "Discharge time = ", DEC5 dischargeTime, " u-seconds."
DEBUG CR, CR, "Sound Frequency = ", DEC5 sound, " Hz."
PAUSE 500
RCTIME
RCTIME 15, 1, light
takes care of the time measurement and data storage.
VAR
VAR
VAR
CON
Word
Word
Word
40

Related parts for 28129