Arduino Nano seem to be "hanging" need advice please

Hi guys,

I've tried integrating interrupts for and sleep from this link here

into my code and it didn't work as intended so i uncommented it out and ran my normal code and now my normal code seems to be locking up or hanging? I added Serial.prints all around my functions and it seems to run about 7-9 times before it "hangs". When i close and reopen the serial monitor, the code resets and it restarts to run 7-9 times again before hanging. Does anyone know the cause of this?

Things I've tried:

  • Re-uploading blank sketch -> working as expected
  • Using sleep_disable() and detachInterrupt -> didn't seem to have done anything
  • Implementing a basic timer and Serial.print -> working as expected
  • Hard resetting the nano -> resets as expected
  • Checked ADC if it was turned on/off -> it is on as expected

Things i did notice:

  • Before i uploaded the sketch with the interrupts, the LED on the Nano itself was Green+Red and my sketch was working as expected
  • After the sketch was uploaded with interrupts, the red LED is not lighting up

Any advice or help would be beneficial! Many Thanks

source_v3.ino (14.6 KB)