Pushbutton - normally open
Tony11
Posts: 41
What I need help with, is. I want to know how to program pushbutton switch and led. When you push and let go of the switch, led will turn on and stay on, till you push the switch, for the second time. Then led will go off. So like A Latch.
I do know how to program ButtonToLed.
Thank you
I do know how to program ButtonToLed.
'' File: ButtonToLed '' Led mirrors pushbutton state. PUB ButtonLed ' Pushbutton/Led Method dira[noparse][[/noparse]6] := 1 ' P6 → output dira[noparse][[/noparse]22] := 0 ' P22 → input (this command is redundant) repeat ' Endless loop outa[noparse][[/noparse]6] := ina[noparse][[/noparse]22] ' Copy P22 input to P6 output
Thank you
Comments
This should work. I reconmend looking for the button debouncer driver I posted in the obex and using it to look for when the button has been pressed. Each time the button is pressed you simply flip the out state.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
find this post?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"powered by Propeller" domed stickers $1.50 - Find them here
Check out my Design and Technology project for my Higher School Certificate www.ecosureblog.net
The Sarah Myatt Fund - Help Sarah and Her Family Fight Quadriplegia HERE