-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added a copy of the LowPower library for future reference
- Loading branch information
Patrice Godard
committed
May 1, 2015
1 parent
9313e03
commit 6fc3300
Showing
7 changed files
with
1,141 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
31 changes: 31 additions & 0 deletions
31
Low-Power-master/Examples/idleWakePeriodic/idleWakePeriodic.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// **** INCLUDES ***** | ||
#include "LowPower.h" | ||
|
||
void setup() | ||
{ | ||
// No setup is required for this library | ||
} | ||
|
||
void loop() | ||
{ | ||
// Enter idle state for 8 s with the rest of peripherals turned off | ||
// Each microcontroller comes with different number of peripherals | ||
// Comment off line of code where necessary | ||
|
||
// ATmega328P, ATmega168 | ||
LowPower.idle(SLEEP_8S, ADC_OFF, TIMER2_OFF, TIMER1_OFF, TIMER0_OFF, | ||
SPI_OFF, USART0_OFF, TWI_OFF); | ||
|
||
// ATmega32U4 | ||
//LowPower.idle(SLEEP_8S, ADC_OFF, TIMER4_OFF, TIMER3_OFF, TIMER1_OFF, | ||
// TIMER0_OFF, SPI_OFF, USART1_OFF, TWI_OFF, USB_OFF); | ||
|
||
// ATmega2560 | ||
//LowPower.idle(SLEEP_8S, ADC_OFF, TIMER5_OFF, TIMER4_OFF, TIMER3_OFF, | ||
// TIMER2_OFF, TIMER1_OFF, TIMER0_OFF, SPI_OFF, USART3_OFF, | ||
// USART2_OFF, USART1_OFF, USART0_OFF, TWI_OFF); | ||
|
||
// Do something here | ||
// Example: Read sensor, data logging, data transmission. | ||
} | ||
|
33 changes: 33 additions & 0 deletions
33
Low-Power-master/Examples/powerDownWakeExternalInterrupt/powerDownWakeExternalInterrupt.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// **** INCLUDES ***** | ||
#include "LowPower.h" | ||
|
||
// Use pin 2 as wake up pin | ||
const int wakeUpPin = 2; | ||
|
||
void wakeUp() | ||
{ | ||
// Just a handler for the pin interrupt. | ||
} | ||
|
||
void setup() | ||
{ | ||
// Configure wake up pin as input. | ||
// This will consumes few uA of current. | ||
pinMode(wakeUpPin, INPUT); | ||
} | ||
|
||
void loop() | ||
{ | ||
// Allow wake up pin to trigger interrupt on low. | ||
attachInterrupt(0, wakeUp, LOW); | ||
|
||
// Enter power down state with ADC and BOD module disabled. | ||
// Wake up when wake up pin is low. | ||
LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF); | ||
|
||
// Disable external pin interrupt on wake up pin. | ||
detachInterrupt(0); | ||
|
||
// Do something here | ||
// Example: Read sensor, data logging, data transmission. | ||
} |
16 changes: 16 additions & 0 deletions
16
Low-Power-master/Examples/powerDownWakePeriodic/powerDownWakePeriodic.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// **** INCLUDES ***** | ||
#include "LowPower.h" | ||
|
||
void setup() | ||
{ | ||
// No setup is required for this library | ||
} | ||
|
||
void loop() | ||
{ | ||
// Enter power down state for 8 s with ADC and BOD module disabled | ||
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); | ||
|
||
// Do something here | ||
// Example: Read sensor, data logging, data transmission. | ||
} |
Oops, something went wrong.