Rampz
Well-known member
Hello All
This is my first post, help please
I copied some of the code from a book, played with it in ways only someone with no experience can and although it does work i noticed some issues, code as below
The output switches on when button is pressed and it should stay on if the button is kept pressed, but i notice with the button pressed and held there is a flicker from the LED i really wanted the led to stay on as along as the button is pressed plus 400ms.
There are 2 requirements
If the button is pressed for say 20ms then i want the output to stay on for 400ms
if the button is pressed and held on then i want the output to stay on till button released plus 400ms
This drives a motor via a mosfet and the button is a tilt switch, i don't want the quick flash i currently get, currently i use a 555 timer chip and that works well but the current draw from the timer is quite high compared to the picaxe, so hoping to get the same effect at a lower current draw and the ability to add aditional features to my project
My answer to that was to set the frequency to 8mhz which does help but maybe there is a better way of doing this?
This is my first post, help please
I copied some of the code from a book, played with it in ways only someone with no experience can and although it does work i noticed some issues, code as below
Code:
#picaxe 08m2
#no_data
setfreq m8 ' i set to 8mhz to see if it would help
symbol green = 4 'pin c4
symbol light = 400 'wait 400ms
symbol btn = pinc.3 'pin c3
main:
if btn = 1 then
high green ' turn on green led
pause light ' wait 400ms
low green ' turn green led off after
endif
goto main
There are 2 requirements
If the button is pressed for say 20ms then i want the output to stay on for 400ms
if the button is pressed and held on then i want the output to stay on till button released plus 400ms
This drives a motor via a mosfet and the button is a tilt switch, i don't want the quick flash i currently get, currently i use a 555 timer chip and that works well but the current draw from the timer is quite high compared to the picaxe, so hoping to get the same effect at a lower current draw and the ability to add aditional features to my project
My answer to that was to set the frequency to 8mhz which does help but maybe there is a better way of doing this?
Last edited: