User Tools

Site Tools


lab6

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
lab6 [2018/11/08 22:12]
dan.tudose
lab6 [2018/11/08 22:13] (current)
dan.tudose
Line 11: Line 11:
 <code C> <code C>
  
-#include <ZigduinoSleep.h>+/* This is an example for SparrowVSleep library. 
 +    You need to call SparrowV_SleepInit function. 
 +    The funciton has 2 params. 
 +    1st param: integer (1 second, greater than 1 second) (represent time in seconds, how long the board will sleep) 
 +    2nd param: bool (true - with data retention, false - with no data retention) 
 +               In case of no data retention the board can sleep max 8 secons and it will 
 +    reboot after time end. 
 +*/
  
-int led = 11; +#include <SparrowVsleep.h>
-int state = 0; +
- +
-void setup() {                 +
-   +
-  pinMode(led, OUTPUT); +
  
 +void setup() {
   Serial.begin(9600);   Serial.begin(9600);
-  Serial.println("Sleep test"); 
-   
-  ZigduinoSleepInit(); 
 } }
  
 void loop() { void loop() {
-   ZigduinoSleepSet(1); +  // put your main code here, to run repeatedly: 
-   +  Serial. println("****************************")
-   //Code that is executed before sleep +  Serial.println("Start")
-   state ^= 1+  Serial.flush(); 
-   if(state == 0digitalWrite(led, HIGH);    + 
-     else digitalWrite(ledLOW); +  //sleep for 25 seconds with data retention 
-    +  SparrowV_SleepInit(25true); 
-   Serial.begin(9600); + 
-   Serial.println("Test"); +  Serial.println("Stop"); 
-   Serial.flush(); +  Serial. println("****************************"); 
-   Serial.end(); +  Serial. println(); 
-    +  Serial.flush(); 
-   //End of code +  delay(5000);
-    +
-   ZigduinoSleep(); +
-   +
 } }
 </code> </code>
lab6.1541707962.txt.gz · Last modified: 2018/11/08 22:12 by dan.tudose