User Tools

Site Tools


mbstring extension must be loaded in order to run mPDF
lab6

This is an old revision of the document!


Sleep, Low Power și Sincronizare

Codul pentru bilbioteca ZigduinoSleep poate fi descăcat de aici.

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */
 
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
 
#include <avr/sleep.h>
#include <avr/interrupt.h>
#include <ZigduinoSleep.h>
 
int led = 11;
int state = 0;
 
void setup() {                
 
  pinMode(led, OUTPUT); 
 
  Serial.begin(9600);
  Serial.println("Sleep test");
 
  ZigduinoSleepInit();
}
 
void loop() {
   ZigduinoSleepSet(1);
 
   //Code that is executed before sleep
   state ^= 1;
   if(state == 0) digitalWrite(led, HIGH);   
     else digitalWrite(led, LOW);
 
   Serial.begin(9600);
   Serial.println("Test");
   Serial.flush();
   Serial.end();
 
   //End of code
 
   ZigduinoSleep();
 
}
lab6.1415716868.txt.gz · Last modified: 2014/11/11 16:41 by dan.tudose