Regarding to LENARDO; using a rotary encoder

Hi, this is Yim.

I am learning how to code in Arduino but there is a question; between Uno and Leonardo.

I am trying to read serial signal of rotary encoder through a Arduino. But, it does not work when Leonardo is used.(by the way, it works when Uno is used.)

What do I miss?

Could you explain what is wrong and how to solve this?

The code is attached below and the rotary encoder is connected with pin 2, 4 and 5V

practice1.ino (711 Bytes)

practice1.ino (711 Bytes)

The INT0, INT1 pins on the Leonardo are opposite those on the Uno.

Leonardo --
External Interrupts: 3 (interrupt 0), 2 (interrupt 1), 0 (interrupt 2), 1 (interrupt 3) and 7 (interrupt 4). These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value.

[Haven't downloaded your .INO]