Sooo, I have an Arduino Yun and was messing with trying to get it to low power consumption running some test sketches. I uploaded a sketch I was wanting to test. and eh… now its stuck in sleep mode.
Stupid me put it in the deepest sleep possible and my pc now wont even recognize the Arduino when I plug it in Worst part is, its not my Arduino, its my works! D: Heres the sketch I am using. Any ways to clear the chips memory?
#include <avr/interrupt.h>
#include <avr/power.h>
#include <avr/sleep.h>
#include <avr/io.h>
#define LED 2
void setup()
{
pinMode(LED, OUTPUT);
digitalWrite(LED, HIGH);
}
void loop()
{
sleepNow();
}
void sleepNow(void)
{
// Set pin 2 as interrupt and attach handler:
attachInterrupt(4, pinInterrupt, HIGH);
delay(100);
//
// Choose our preferred sleep mode:
set_sleep_mode(SLEEP_MODE_IDLE);
//
// Set sleep enable (SE) bit:
sleep_enable();
//
// Put the device to sleep:
digitalWrite(LED,LOW); // turn LED off to indicate sleep
sleep_mode();
//
// Upon waking up, sketch continues from this point.
sleep_disable();
digitalWrite(LED,HIGH); // turn LED on to indicate awake
}
void pinInterrupt(void)
{
detachInterrupt(4);
}
Any help is greatly appreciated!