Hi Guys
I have looked through endless topics on various switch/ pwm/ led programs and problems on this forum and it has so far helped me to write this basic code.
Being new to the whole programming/ picaxe thing i was wondering if someone would be able to look over my code and tell me if i am going the right way about things.
I am using a toggle switch for the input and the two outputs are linked to the shutdown pins on two led drivers.
I seem to get some sort of switch bounce depending on speed the switch is activated causing the program to jump steps.
Is there an alternative way of achieving the result i am after. I have looked at the button code but my programming is not that good and i did read that it does not cure all switch bounce.
many thanks
I have looked through endless topics on various switch/ pwm/ led programs and problems on this forum and it has so far helped me to write this basic code.
Being new to the whole programming/ picaxe thing i was wondering if someone would be able to look over my code and tell me if i am going the right way about things.
I am using a toggle switch for the input and the two outputs are linked to the shutdown pins on two led drivers.
I seem to get some sort of switch bounce depending on speed the switch is activated causing the program to jump steps.
Is there an alternative way of achieving the result i am after. I have looked at the button code but my programming is not that good and i did read that it does not cure all switch bounce.
Code:
main:
low 1
low 2
nap 4
main1:
if pin3 = 1 then goto flash
goto main1
Flash:
nap 2
flash1:
pwm 1,5,10
pwm 2,3,10
if pin3 = 1 then goto lowfull
goto flash1:
lowfull:
high 1
low 2
nap 4
cont1:
if pin3 = 1 then goto fullon
goto cont1
fullon:
high 1
high 2
nap 4
fullon1:
if pin3 = 1 then goto main
goto fullon1
Last edited: