momentary pushbutton to 3-way toggle

Thread Starter

kgstewar

Joined Apr 5, 2012
152
Hi all, I am trying to turn a momentary pushbutton into a three-way toggle switch. First push - lights left LED; second push - lights the middle LED; third push - lights the right LED; fourth push - back to the left LED, etc.

I assume this can be done with a flip-flop, but I'm such a noob, I'm not sure which to use or how to set this up. Any help greatly appreciated!

Kevin
 

MikeML

Joined Oct 2, 2009
5,444
...
I assume this can be done with a flip-flop,..
Actually, it would take a minimum of two flip-flops. You are describing a state-machine that has three states. Two flip-flops potentially can make a state machine that has 2λ2= 4 states. In your case, one of those is not useful, so you can think of the state machine of having only three, called 0,1,2,0,1,2,...

Note that the solution described above using the 4017 decade counter (ten states) effectively shortens the normall counting sequence from 0,1,2,3,4,5,6,7,8,9,0,1,... to 0,1,2,0,1,2,...
 

Thread Starter

kgstewar

Joined Apr 5, 2012
152
That makes sense re: the flip-flops. I need a flip-flop-flup. Looks like the 4017 solution is pretty simple.

Thanks!

Kevin
 

Thread Starter

kgstewar

Joined Apr 5, 2012
152
I should connect pin 7 to pin 15 so that it counts 0,1,2,0,1,2, etc., correct? Or by connecting pin 10 to reset will it cycle through and make pins 2,4,7, go to high in a repeating sequence? Thanks!
 
Last edited:

Ron H

Joined Apr 14, 2005
7,063
You will have to debounce your switch to prevent multiple pulses when you depress and/or release the switch. Since the 4017 has a Schmitt trigger on the clock input, you can use a simple circuit like this. It will clock the 4017 when you release the switch. If you want it to clock when you depress the switch, swap the switch and resistor, or use a normally-closed switch.

Note: The TI CD4017 has a Schmitt trigger clock input. Other mfr's parts may not.
 
Top