Arduino - Finite State Machine does not start in the initial state

'm building a state machine using 6 flip-flopsD, and an G input coming from an infrared sensor. This circuit should count from 0-35. The problem is that it always starts in state 111111. That is, after it passes through Flip-flop D A, B, C, D, E, F = 1;

Here's my code:Dontpad

Here's my Flip-FlopD:Dontpad

Can someone tell me what's wrong?

One letter global variable names are a problem waiting to happen. When you use MEANINGFUL names, I'll look at the code again.

answered on Stack Exchange

  if (CLK=true) {