Hi Everyone,
I haven't quite thought of anything USEFUL yet to do with my Picaxe, so I'm just having a little fun. This is my second attempt at programming the 08M2. It's flashing blue and red police lights and a siren. An all too common sight in the low-rent district I live in!
I haven't quite thought of anything USEFUL yet to do with my Picaxe, so I'm just having a little fun. This is my second attempt at programming the 08M2. It's flashing blue and red police lights and a siren. An all too common sight in the low-rent district I live in!
Code:
' Flashing Police Lights and Siren
'connect 2 blue LEDs in parallel (anode to anode, both cathodes to gnd),
'connect one of these anodes thru 470 ohm resistor to output 1 on 08M2
'likewise, connect 2 red LED's to output 4
'connect one side of piezo speaker to output 2, other side to gnd
symbol bluelights = 1
symbol redlights = 4
symbol siren = 2
start0:
high bluelights 'flash blue lights
low redlights
pause 70
low bluelights
high redlights 'flash red lights
pause 70
goto start0
start1: 'sound siren simultaneously
for b0 = 40 to 105
sound siren, (b0, 2)
next b0
for b1 = 105 to 40 step -1
sound siren, (b1, 2)
next b1
goto start1
Attachments
-
265.6 KB Views: 112