I have a switch but I cant use a microcontroler for this project cause I need this really simple circuit that I will describe to be cheap and easy to make cause it will be used in at least 300 places.
I have a 5v battery and once I press (down and up) a switch I need it to turn on a led. When I press it again I need to turn off that led. With an arduino I can easily save the state of the first press and check if the button was pressed or not and turn on/off the led. Without a microcontroler I dont know how to do that. Is there some simple circuit that can turn on and off a led when pressed?
Just use a self locking switch. ( these are DIFFERENT from on off switches), They have a mechanical 'latch' inside but the button ALWAYS returns to the start position, however the internal contacts 'remember' the state.
So :
1.button down and up = switch internally 'closed'
2.button down and up = switch internally 'open'
3. go to 1
@Audioguru thank you, I can undestand that circuit but it would be too complicated to me. The self locking switch would be better to my purpose. I only knew about the momentary switchs, I didnt know of this kind of switch. They are very cheap $1 and it is much cheaper than creating that circuit you @Audioguru provided but it's always good to know it is possible to build it!