Hi all,
I have learned a lot from the people here. To-day I am asking for some help with my program. Been working with it since July 2015.
I want a push button to be detected immediately to change a LED flash sequence.
Manual 3 says SETINT is polled between program lines. I thought that would get it done.
As written the program will leave flash1 and proceed to flash2 but will not leave flash2.
The program is below. An experienced eye is appreciated.
Thank you for your help.
David
Code
I have learned a lot from the people here. To-day I am asking for some help with my program. Been working with it since July 2015.
I want a push button to be detected immediately to change a LED flash sequence.
Manual 3 says SETINT is polled between program lines. I thought that would get it done.
As written the program will leave flash1 and proceed to flash2 but will not leave flash2.
The program is below. An experienced eye is appreciated.
Thank you for your help.
David
Code
Code:
'08M2 FBI style LED strobing_Jul_26_2015_1007.bas
'Program by David Beatty @ Edmonton, Alberta
'inspired by a Youtube video [URL]https://www.youtube.com/watch?v=tQoZCix_1mY[/URL]
'Labelled RC car flasher (FBI style) by Vicsys, [URL]http://vicsys.hu[/URL]
'
#Picaxe 08M2
#no_data
setint %00010000,%00010000 'button on C.4'
pinC.4 = b1 'declare button on C.4
b1 = 0 'initialize b1'
Interrupt: 'used to get an imediate button response
high C.0: high C.1 'turn 'em all on to show flash sequence change
pause 1000 'time to see the button push was detected
b1 = b1 + 1 'cause the program to select the next flash sequence
if b1 = 1 then flash1 'array of flash sequences
if b1 = 2 then flash2
if b1 = 3 then flash3
if b1 = 4 then flash4
if b1 = 5 then flash5
if b1 = 6 then flash6
if b1 = 7 then flash7
if b1 = 8 then flash8
if b1 > 8 then flash1
setint %00010000,%00010000 'resets the setint for the next button push
return
'flash sequence catalogue
flash1:
do
high C.0: high C.1 'all on for area illumination
loop
flash2:
do
pulsout C.0, 255: pulsout C.1,255 'simultaneous flash of both LEDs
pause 150
pulsout C.0,255: pulsout C.1,255
loop
flash3: 'LEDs both pulse 3X, wait 1 sec. - loop
do
high C.0, C.1
pause 100
low C.0, C.1
pause 100
high C.0, C.1
pause 100
low C.0, C.1
pause 100
high C.0, C.1
pause 100
low C.0, C.1
pause 600
loop
flash4: 'LED right pulses 2X then LED left pulses 2X loop
do
pulsout C.0, 255:pause 60: pulsout C.0,255 pause 400
pulsout C.1, 255:pause 60: pulsout C.1,255 pause 400
loop
flash5: 'LED right pulses 2X and remains high while LED left pulses 2X and remains high - loop
do
pulsout C.0,150
pause 80
high C.0
pause 30
low C.0
Pulsout C.1,150
pause 80
high C.1
pause 30
low C.1
pause 30
loop
flash6: 'LED right pulses 2X pausing while LED left pulses 2X and pauses, loop
do
pulsout C.0,255
pause 100
pulsout C.0,255
pause 100
pulsout C.1,255
pause 100
pulsout C.1,255
pause 125
loop
flash7: ' wig wag pattern
do
pulsout C.0,255
pause 100
pulsout C.1,255
pause 100
pulsout C.0,255
pause 100
pulsout C.1,255
pause 100
pulsout C.0,255
pause 100
pulsout C.0,255
pause 100
pulsout C.1,255
pause 100
pulsout C.1,255
pause 100
pulsout C.0,255
pause 100
pulsout C.1,255
pause 100
pulsout C.0,255
pause 100
pulsout C.1,255
pause 100
loop
flash8: 'alternating wig wag pattern
do
pulsout C.0,255
pause 100
high C.0
pause 170
low C.0
pause 600
pulsout C.1,255
pause 100
high C.1
pause 170
low C.1
pause 600
loop
Last edited by a moderator: