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)

  • hof Reply

    Why did you steal an article straight off without even checking the contents of the article?

    Do you think this line of code will work?
    #include // Include library containing low power functions

    April 11, 2013 at 2:46 pm
  • Chao Reply

    Hello Hof,

    Indeed, I shouldn’t do so, just deleted the article but left the code.

    April 11, 2013 at 4:13 pm
  • ATTiny84 mit Arduino Uno programmieren | 3bm.de Reply

    […] nutzte ursprünglich den ATtiny Core von GitHub und musste beim Versuch, die JeeLib für tiefe Schlafzustände (Sleepy::loseSomeTime()) des ATTiny’s zu nutzen feststellen, dass mir das Ganze immer mit […]

    September 18, 2013 at 1:57 am
  • poulbran Reply

    That would be great for H2O monitoring on a farm.

    September 12, 2016 at 9:00 am

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.