LED and Piezo
arien009
Posts: 7
Hi,
May I know what command can I use to get the LED to flash and piezospeakers to beep at the same time? Eg. LED to flash 6 times with 1 second interval, and concurrently piezospeaker to beep with 1 second interval.
Thanks.
May I know what command can I use to get the LED to flash and piezospeakers to beep at the same time? Eg. LED to flash 6 times with 1 second interval, and concurrently piezospeaker to beep with 1 second interval.
Thanks.
Comments
If the pizo has a built in oscillator, then you just send it a output:
FOR i = 1 to 6
PIN2 = 1 turns on LED
PIN5 = 1 turns on pizo
PAUSE 1000 do nothing for 1000 milliseconds
PIN2 = 0 turn off LED
PIN5 = 0 turn off pizo
PAUSE 1000
next i
Otherwise you would:
FOR i = 1 to 6
PIN2 = 1 turns on LED
FREQOUT 5,1000, 2000 oscillates pizo at 2000Hz for 1000 milliseconds
PIN2 - 0 turns off LED
PAUSE 1000 do nothing for 1000ms
next i
You'll need to setup your pins as outputs of course. I hope this helps
P.S. yea I didn't use the code feature so all my formatting is gone. sorry.
What if I do not have one?
No, I don't think the beo-bot piezo speakers has a built in oscillator, you have to use the FREQOUT command (look at Spiral_72 code)
You could also have a look at the (Whats a Microcontroller? v3.0 (.pdf) and the ( BASIC Stamp Manual v2.2 (.pdf)
-Phil