Skip to content

Instantly share code, notes, and snippets.

@shivams

shivams/main.cpp Secret

Created January 26, 2019 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shivams/6212275db9a69cd2444e064715f4e9b6 to your computer and use it in GitHub Desktop.
Save shivams/6212275db9a69cd2444e064715f4e9b6 to your computer and use it in GitHub Desktop.
Particle Sleep State Testing
#include "Particle.h"
SYSTEM_MODE(SEMI_AUTOMATIC);
SYSTEM_THREAD(ENABLED);
void setup() //hardware initialization.
{
Serial.begin(9600); //enable serial port.
}
void loop() {
////////////////////
// Stage-1 : WAKE //
////////////////////
Serial.println("Normal State Starts");
delay(16000); //16 seconds of normal state
Serial.println("Normal State Ends");
/////////////////////
// STAGE-2 : SLEEP //
/////////////////////
Serial.println("Sleep begins");
System.sleep(SLEEP_MODE_SOFTPOWEROFF, 16); //16 seconds of deep-sleep
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment