arduino micro interrupt on Pin4 (RX) /D0


I try to use interrupt D0 (pin4 of the Arduino micro):

void saveBeforeDie(){
  Serial.print(F("Save before die:"));
  pinMode(0, INPUT);
   pinMode13, OUTPUT);
  attachInterrupt(2, powerSupplyInt, FALLING);
  digitalWrite(13, LOW);
  Serial.println(F("If the power shut down, values will be saved and pin will goes up"));

void powerSupplyInt(){
  digitalWrite(13, HIGH);

Is that right for the Arduino Micro ?

Best regards Thierry Vormds

Yes, that looks right. What are you connecting to the D0 pin? Does it not work?

You need to follow the rules and post ALL your code.

For my self I don't think you have a hope in hell of printing any thing when the power fails, NOR do I see how D0 got in to this (interrupt 2 is normally D3)


I think he got the interrupt number right.