Closed nopdotcom closed 8 years ago
(This is tested, but I am not certain about the twisty little maze of pin-to-pin-to-interrupt mappings.)
On Leonardo/32u4, digital pin 7 (aka PE6, aka INT6) is connected to Arduino core interrupt 4. For the Arduino mapping, see:
https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/WInterrupts.c#L102
Tested with this variant on the Basic example:
Encoder myEnc(7, 6); void loop() { // demonstrate encoder changes are registered while not being read() delay(1000); long newPosition = myEnc.read(); if (newPosition != oldPosition) { oldPosition = newPosition; Serial.println(newPosition); } }
I have not removed the “untested” comment on the Leonardo definition, as I have not tested pins 0-3.
(This is tested, but I am not certain about the twisty little maze of pin-to-pin-to-interrupt mappings.)
On Leonardo/32u4, digital pin 7 (aka PE6, aka INT6) is connected to Arduino core interrupt 4. For the Arduino mapping, see:
https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/WInterrupts.c#L102
Tested with this variant on the Basic example:
I have not removed the “untested” comment on the Leonardo definition, as I have not tested pins 0-3.