Simple LED and Freqout help needed.
NWUpgrades
Posts: 292
I am trying to modify the program toggle.bs2 to have 6 LED's and 2 Piezo speakers. I want the LED's to sound at the same time as the LED's. When I run the program the way I have it, the LED's light up and then the speakers sound. Is it even possible to do this? Here is the modified program: Note that the LED's are on pins 0-3 and 14-15. Thanks
' {$STAMP BS2}
·· ' {$PBASIC 2.5}
· thePin VAR Nib ' pin 0 - 15
· Setup:
· DIRA = %1111 ' make LEDs output, low
· Main:
· DO
· FREQOUT 12, 2000, 1500·· ' Signal to Piezo speaker 1
· FREQOUT 13, 2000, 1000·· ' Signal to Piezo speaker 2
· FOR thePin = 0 TO 15 ' loop through pins
· TOGGLE thePin ' toggle current pin
· DEBUG HOME, BIN6 OUTA ' show on Debug
· PAUSE 100 ' short delay
· NEXT
· LOOP ' repeat forever
·
' {$STAMP BS2}
·· ' {$PBASIC 2.5}
· thePin VAR Nib ' pin 0 - 15
· Setup:
· DIRA = %1111 ' make LEDs output, low
· Main:
· DO
· FREQOUT 12, 2000, 1500·· ' Signal to Piezo speaker 1
· FREQOUT 13, 2000, 1000·· ' Signal to Piezo speaker 2
· FOR thePin = 0 TO 15 ' loop through pins
· TOGGLE thePin ' toggle current pin
· DEBUG HOME, BIN6 OUTA ' show on Debug
· PAUSE 100 ' short delay
· NEXT
· LOOP ' repeat forever
·
Comments
for i = 1 to 10
freqout 12,200,1500
toggle 0
next i
for i = 1 to 10
freqout 13,200,1000
toggle 1
next i