My application was successfully using INT1 (D3) on the Moteino but I have moved everything to the MegaMoteino. The only available interrupt on the MegaMot is one of the two pins used for the hardware SER1.
Do I need to do anything special in code first to deactivate the SER1 function or do I just call the same code as before:
Here are the relevant snippets:
void setup(){
attachInterrupt(1, debounceInterrupt, FALLING);
digitalWrite(11,INPUT_PULLUP); // on Mega using Pin 11 INT1
}
void Loop(){
//do stuff here
}
void debounceInterrupt(){
if(((long)(micros() - last_micros) >= debouncing_time * 1000)) {
last_micros = micros();
interrupt_flag = true; //set flag but make sure to reset it later - it is checked my void Loop() routines
}
}
I tried the identical Moteino button debounce interrupt code on the Mega without any changes and it does not work any more.
The RFM uses interrupt 2 on the MEGA and there's nothing special about it. The same code should work just fine as long as you setup the interrupt the same way. So INT0 and 1 are on the SER1 pins.