Statistics
| Revision:

root / Ports / examples / powerdown_demo / powerdown_demo.pde

History | View | Annotate | Download (723 Bytes)

1
//>>> The latest version of this code can be found at https://github.com/jcw/ !!
2
3
// Sample code to power down a JeeNode completely
4
// 2010-08-16 <jcw@equi4.com> http://opensource.org/licenses/mit-license.php
5
// $Id: powerdown_demo.pde 7763 2011-12-11 01:28:16Z jcw $
6
7
#include <Ports.h>
8
#include <RF12.h>
9
10
void setup () {
11
    // turn the radio off completely
12
    rf12_initialize(17, RF12_868MHZ);
13
    rf12_sleep(RF12_SLEEP);
14
15
    // blink the blue LED three times, just because we can
16
    PORTB |= bit(1);
17
    DDRB |= bit(1);
18
    for (byte i = 0; i < 6; ++i) {
19
        delay(100);
20
        PINB = bit(1); // toggles
21
    }
22
23
    // stop responding to interrupts
24
    cli();
25
    
26
    // zzzzz... this code is now in the Ports library
27
    Sleepy::powerDown();
28
}
29
30
void loop () {}