I built a state machine using JK flip flops, I tested it but I kept getting seemingly random results. I decided to test each jk flip flop individually. Here is the schematic for my testing:
Both LEDs should toggle whenever the clock goes high to low (everytime I release the push button) and thats what usually happens but every few tries the toggle doesn't occur at all or it happens when CLK goes high and when it goes low. I made a video of the aforementioned test: JK flip flop Test
I tested 4 different IC (8 flip flops) and they all presented the same behaviour.
All flip flops' set, reset and memory worked perfectly.
Why does this malfunction happen and how can I prevent it from happening?