Hi,
So does anyone have any of the libraries working with Mega?
I've tried PinChangeInt since Tom says it works, but I can't even get a single pin to interrupt.
I'm using PinChangeInt from
https://github.com/GreyGnome/PinChangeInt with this:
#include <PinChangeInt.h>
#define PIN 20
volatile uint16_t interruptCount=0;
void interruptFunction() {
interruptCount++;
}
void setup() {
Serial.begin(9600);
Serial.print("PinChangeInt");
pinMode(PIN, INPUT);
digitalWrite(PIN, HIGH);
PCintPort::attachInterrupt(PIN, interruptFunction, CHANGE);
// (RISING, FALLING, CHANGE)
}
void loop() {
delay(1000); // Every second,
Serial.print("Pin was interrupted: ");
Serial.print(interruptCount, DEC); // print the interrupt count.
Serial.println(" times.");
Serial.print("Currently: ");
int buttonState = digitalRead(PIN);
Serial.println(buttonState);
}
In the end I'm planning to have 3 pins interrupted, and I was hoping to avoid doing it manually and figuring out which is which or having them on different ports.