I've made a circuit on Logisim that allows me to switch between three LEDs at the push of a button. Essentially allowing me to cycle between OFF, LED1, LED2 and LED3 repeatedly. I'm doing this using four D Flip-Flops.

However, I'm getting an issue that if you hold down the button it will keep cycling through all the options. This isn't much of a problem at low clock speeds but at like 64hz it's unusable. I want to use a higher frequency clock so essentially I want it to only switch when the user presses but if he holds down the switch it won't go to the next iteration in the cycle.

I'm a software developer and can barely remember the stuff I learned in college about circuits so please explain me like I'm 5.



Thank you guys so much for all the help. I ended up trying to make both the version with 4 flip flops and the one with 3. Both are really good solutions and require about the same amount of circuitry.

4 Flops

enter image description here

3 Flops

enter image description here

  • \$\begingroup\$ If you just want to switch between 4 states. Then why do you need a high clock frequency?? \$\endgroup\$
    – User
    Nov 12, 2019 at 15:31
  • 3
    \$\begingroup\$ why not just have the (properly debounced) button be the clock? \$\endgroup\$
    – Hearth
    Nov 12, 2019 at 15:32
  • \$\begingroup\$ Well the problem is at like 1-2hz I will probably have to hold the button down for like half second to switch. But if I hold it too long then I will go to the next level and then I have to cycle all the way back around. So it's not really nice UX for the user. It's simple if it just disregarded thee long presses. \$\endgroup\$ Nov 12, 2019 at 15:33
  • \$\begingroup\$ @Hearth what do you mean by that? sorry I'm a noob \$\endgroup\$ Nov 12, 2019 at 15:38
  • \$\begingroup\$ think about this ... how would you do it in software? \$\endgroup\$
    – jsotola
    Nov 12, 2019 at 18:09

2 Answers 2


I think you should build a proper state machine. I think you will need 8 states, so 3 flip-flops would be enough. The additional 4 states would be used to detect the press of a button, so you would only change which LED is illuminated when the current state of the button is pressed and the previous state of the button was not pressed.

  • \$\begingroup\$ Oh cool thank you this makes sense \$\endgroup\$ Nov 12, 2019 at 15:40
  • \$\begingroup\$ Wont a 3 bit ring counter do the trick? \$\endgroup\$
    – User
    Nov 12, 2019 at 15:58
  • \$\begingroup\$ @ASWINVENU Won't an Arduino do the trick? \$\endgroup\$ Nov 12, 2019 at 16:08
  • \$\begingroup\$ @HarrySvensson Of course. But look at the question. The man want to achieve this using a logic circuit. \$\endgroup\$
    – User
    Nov 12, 2019 at 16:12
  • 1
    \$\begingroup\$ I AM ACTUALLY A BEAR. ROAR \$\endgroup\$ Nov 12, 2019 at 18:51

May I suggest you create a ring counter. That would be the easiest way to do so.

4-bit ring counter

Here is a link to the info: Electronics Tutorials - Ring Counters

  • \$\begingroup\$ I will try this thanks :) \$\endgroup\$ Nov 12, 2019 at 15:38
  • 1
    \$\begingroup\$ @AntersBear CLK is your switch. \$\endgroup\$ Nov 12, 2019 at 18:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.