Help with interupt

In the original, the ISR is weAreInNuetral(), and it calls reset(), which will happen, interrupts enabled or no.

This wokwi simulation boils away what I read in @kb9vjq's code, with the correction I mentioned. There is only one ISR in the original, it calls reset(), like the below.

See it here


// https://wokwi.com/projects/432431747646149633

void (*reset) (void) = 0;

// alternate definition
//void reset() { asm volatile ("jmp 0"); }

void setup() {
  Serial.begin(15200);
  Serial.println("\nGot reset!");

  pinMode(2, INPUT_PULLUP);

  // wait for interrupt line to be HIGH
  do delay(50); while (digitalRead(2) == LOW);
  delay(50);

  attachInterrupt(digitalPinToInterrupt(2), weInNeutral, FALLING);
}

void weInNeutral()
{
//  Serial.println("\nDon't print in ISRs!");
  reset();
}

void loop() {
}

a7