Put Arduino Into Sleep Mode and Works for Weeks

Posted by: Chao Category: Arduino Tags: , , , , Comments: 4

Put Arduino Into Sleep Mode and Works for Weeks

It’s pretty useful when you have a arduino project run a long time when it is fully set up, now you can read about this on this post to get a fully explanation, will be pretty useful for sensor monitoring, wireless things, etc.

Get the JeeLib here. And use the following example code, sleepy function is replaced the delay(1000) function to get the arduino in sleep mode.

[c]
#include <JeeLib.h> // Include library containing low power functions
int led = 13;
ISR(WDT_vect) { Sleepy::watchdogEvent(); } // Setup for low power waiting

void setup() {
pinMode(led, OUTPUT);
}

void loop() {
digitalWrite(led, HIGH);
Sleepy::loseSomeTime(1000); // Instead of delay(1000);
digitalWrite(led, LOW);
Sleepy::loseSomeTime(1000); // Instead of delay(1000);
}
[/c]

This post is refer to hardware startup blog, click here to see the original post.

Share this post

Comments (4)

Leave a Reply

Your email address will not be published. Required fields are marked *