27316 Parallax Inc, 27316 Datasheet - Page 20

Microcontroller Modules & Accessories Penguin Robot BLACK

27316

Manufacturer Part Number
27316
Description
Microcontroller Modules & Accessories Penguin Robot BLACK
Manufacturer
Parallax Inc
Datasheet

Specifications of 27316

Product
Microcontroller Accessories
Core Processor
2PX24 Stamp
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
3.7. TEST CODE LISTINGS
' Parallax Penguin Robot
' Penguin-SpeakerTest.bpx
' {$STAMP BS2px}
' {$PBASIC 2.5}
Speaker
i
Freq
'Inverse of 12th root of 2 multiplied by 65536
'Used to divide by one semitone in a 12 note octave
Scale
Freq = 659
FOR i = 1 TO 12
NEXT
' Parallax Penguin Robot
' Penguin-IRTest.bpx
' {$STAMP BS2px}
' {$PBASIC 2.5}
REmitter
LEmitter
IrInput
LeftIr
RightIr
DEBUG CLS
DEBUG "Infrared sensor status:", CR,
DO
LOOP
ReadIr:
RETURN
Copyright © Parallax, Inc. • Penguin (#27313-27316) • v1.0 7/12/2007
FREQOUT Speaker, 600, Freq
Freq = Freq ** Scale
GOSUB ReadIr
DEBUG CRSRXY, 6, 1, DEC LeftIr
DEBUG CRSRXY, 22, 1, DEC RightIr
PAUSE 150
FREQOUT LEmitter,1,6300
LeftIr = ~IrInput
FREQOUT REmitter,1,6300
RightIr = ~IrInput
"Left:", CRSRXY, 15, 1,"Right:"
PIN
VAR
VAR
CON
CON
CON
VAR
VAR
VAR
12
Byte
Word
61858
2
3
IN4
Bit
Bit
' Frequency of an E5
' 12 semitones = 1 octave
' Play the frequency
' lower frequency by 1 octave
' Prepare debug screen
' Update debug screen with
' status of IR sensors
' Modulate emitters at 38KHz
' and check for reflections
Page 20 of 24

Related parts for 27316