Count the number of rising edges

htliew:
Hi,

I want to count the number of rising edges on the A encoder signals coming out form the motor between two rising edges of the z encoder pulse. My code is as below,

  for (digitalRead(2) == HIGH) {

if (digitalRead(3) == HIGH) {
      countA = countA + 1;
    }

What do you suppose that 'for' does? Perhaps you meant 'while' ?