1 | // **** INCLUDES *****
|
2 | #include "LowPower.h"
|
3 |
|
4 | void setup()
|
5 | {
|
6 | DDRD &= B00000011; // set Arduino pins 2 to 7 as inputs, leaves 0 & 1 (RX & TX) as is
|
7 | DDRB = B00000000; // set pins 8 to 13 as inputs
|
8 | PORTD |= B11111100; // enable pullups on pins 2 to 7
|
9 | PORTB |= B11111111; // enable pullups on pins 8 to 13
|
10 | pinMode(13,OUTPUT);
|
11 | digitalWrite(13, LOW);
|
12 | }
|
13 |
|
14 | int delay13H = 300;
|
15 | int delay13L = 500;
|
16 |
|
17 | void loop()
|
18 | {
|
19 | // Enter power down state for 8 s with ADC and BOD module disabled
|
20 | LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
|
21 |
|
22 | digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
|
23 | delay(delay13H); // wait for a second
|
24 | digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
|
25 | }
|