ansh11
Member level 4
I need to write code for following but I clearly don't have any idea so first I am trying to write pseudo code
When button pressed and released, Turn On led. When button pressed and released again, Turn Off led. Continue process
My work : I check button every 10 ms (timer interrupt) When I see a button change, I start counting interrupts. If the button is the same in the next interrupt, count will increment .
Otherwise, count will clear back to zero if the button has changed.
Once i reach a certain 10 counts. i can say that is a new stable state for the button, so I can say that as one press and turn on led
How to turn off led when second time button is pressed and released
When button pressed and released, Turn On led. When button pressed and released again, Turn Off led. Continue process
My work : I check button every 10 ms (timer interrupt) When I see a button change, I start counting interrupts. If the button is the same in the next interrupt, count will increment .
Otherwise, count will clear back to zero if the button has changed.
Once i reach a certain 10 counts. i can say that is a new stable state for the button, so I can say that as one press and turn on led
How to turn off led when second time button is pressed and released