Forum: µC & Digital Electronics Digital push-button

von Konstantinos (Guest)

Rate this post
0 useful
not useful
Dear μController community,

I am a complete beginner in the field so my question might seem a bit 
In short I need to implement a circuit switch that will change state 
(ON/OFF) every time a short pulse is sent (trigger). In effect it is a 
digital push-button. For instance on a first trigger the circuit open, 
on the 2nd will close..etc..

Do you have any simple solution to this? Is it something easy to 
implement with a μcontroller? I am currently looking for the simplest, 
least time consuming solution so if there is another way other than 
programming ICs please let me know.


von MaWin (Guest)

Rate this post
1 useful
not useful
If the circuit does always have power,
than a simple flip flop does
  +-----------+  CD4011
  |           |                 
  |       +---)----------------+
  |       |   |                |
  |       +--|>o--10k--+--|>o--+-- on/off
  | +         |        |       |  
Battery       |        |       1M
  | -         |        |   _   | 
  |           |        +--o o--+ 
  |           |                | 
  |           |              100nF
  |           |                |

If you loose power, there are specialized
single bit non volatile state saver memory chips like
FM1105B, FM1106, FM1107, FM1110, FM1114 (RamTrom FERAM)

Of course you can program it also into a small micro controller
that has an EEPROM to save state during power loss.
For the Arduino programming environment
char key=0, lastkey=0, savedkey;
const char inputpin = 1;
const char outputpin = 2;

void setup()

void loop()
      EEPROM.write(11, savedkey);
So this is rather simple.

: Edited by Admin


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.