Hello,
I am currently running the latest sparkcore-development branch , in an attempt to get the System.sleep functionality to work correctly.
I am running the following code
void setup() {
Serial.begin(9600);
pinMode(A0, INPUT_PULLUP);
}
void loop() {
delay (1000);
Serial.print("going to sleep for "); Serial.print(SleepTime); Serial.println(" sec");
System.sleep(SLEEP_MODE_DEEP,60);
}
When the device goes to sleep, the LED is off and it is drawing 46.2ma in what’s supposed to be deep sleep mode, which is weird. Sometimes it will actually be in deep sleep mode and draw 0.08ma , other times it will draw 46.2ma . Never consistent though.
Also I have a switch attached to A0 and pressing the switch does not bring the device out of deep sleep.
If I change the line
System.sleep(SLEEP_MODE_DEEP,60);
to
System.sleep(A0,CHANGE,60);
Then the device will also use 40ma while sleeping in this state, but I am able to press the switch and wake up the device from sleep.
However if I change
System.sleep(A0,CHANGE,60);
to
System.sleep(A0,RISING,60);
I am no longer able to use the switch/interrupt to wake the device.
I know there have been a number of threads regarding the sleep of the device. The last thread I followed was https://github.com/spark/firmware/pull/778 , which seemed to help some people. But did not provide a solution for me.
Any ideas are welcomed! Thanks in advance!