Code: Select all
#include <Ports.h>
int led_pin = 12;
ISR(WDT_vect) { Sleepy::watchdogEvent(); } // Setup the watchdog
void setup() {
Serial.begin(57600);
while (!Serial);
Serial.println("in setup");
pinMode(led_pin, OUTPUT);
}
void loop() {
Serial.println("on");
// Turn the LED on and sleep for 5 seconds
digitalWrite(led_pin, HIGH);
Sleepy::loseSomeTime(5000);
Serial.println("off");
// Turn the LED off and sleep for 5 seconds
digitalWrite(led_pin, LOW);
Sleepy::loseSomeTime(5000);
}
I'm a bit of a loss, but also wondering if powering the Micro over USB is having an effect, or perhaps having it in a breadboard is causing some interrupt or something else to fire. The interrupt thing seems unlikely, because I never attach them. In my more complex set-up, I have an RTC hooked up to D2/D3, which are also external interrupts. But I get the same behaviour without the RTC, so it seems unlikely to be a factor.
Any help here would be appreciated.