Hi there! First of all, thank you very much for your activities!
This post has been interesting to me since I need a reliable way to put my teensy3.2 to sleep.
I used Ariels code (thx!) and updated it a little bit:
#include <Snooze.h>
const int led_pin_v = 13;//Led verte
// Load timer driver
//SnoozeTimer timer;
SnoozeDigital digital;
SnoozeUSBSerial usb;
// install timer driver to a SnoozeBlock
//SnoozeBlock config(timer);
SnoozeBlock config(usb, digital);
float j;
void setup()
{
Serial.begin(9600);
pinMode(led_pin_v, OUTPUT);
//timer.setTimer(30000);
digital.pinMode(7, INPUT_PULLUP, RISING);//pin, mode, type
}
void loop()
{
j=1+j;
Serial.print("j= ");
Serial.println(j);
digitalWrite(13, HIGH);
delay (20);
digitalWrite(13,LOW);
delay (20);
if (j>200)
{
delay(1000);
digitalWrite(led_pin_v, LOW);
delay(1000);
Serial.println("Bonne nuit SCAO");
Snooze.deepSleep( config );
delay(10000);
Serial.begin(9600);
Serial.println("Bonjour SCAO");
digitalWrite(led_pin_v, HIGH);
j=0;
}
}
It does:
1. count j to 200
2. go deepsleep
3. wake up on digital PIN 7
4. count again to 2000 (the LED is blinking the way it is supposed to:=))
BUT the serial monitor is strange:
1. Does not show Bonne nuit SCAO
2. Does not show Bonjour SCAO
3. After wake up does not show the counting any more
Per your suggestion I already gave it some seconds after waking up, I put an additional Serial.begin in there, added SnoozeUSBSerial usb. Any other ideas?
Your suggestions are greatly appreciated!
jani