source: rtos_arduino/trunk/arduino_lib/hardware/arduino/samd/libraries/EnergySaving/examples/WakeUpOnExternalInterrupt/WakeUpOnExternalInterrupt.ino@ 224

Last change on this file since 224 was 224, checked in by ertl-honda, 8 years ago

1.7.10のファイルに更新

File size: 783 bytes
Line 
1/********************************************************************************************
2 This sketch demonstrates how sleep function using external interrupt to wake up the MCU.
3 This sketch work only cortex-m0+ boards.
4*********************************************************************************************/
5
6
7
8#include <EnergySaving.h>
9
10EnergySaving nrgSave;
11
12unsigned int i=0;
13
14void setup()
15{
16 nrgSave.begin(WAKE_EXT_INTERRUPT, 8, dummy); //standby setup for external interrupts
17}
18
19void loop()
20{
21 for(i=0; i<20; i++)
22 {
23 digitalWrite(13,HIGH);
24 delay(500);
25 digitalWrite(13,LOW);
26 delay(500);
27 }
28
29 nrgSave.standby(); //now mcu goes in standby mode
30}
31
32
33void dummy(void) //interrupt routine (isn't necessary to execute any tasks in this routine
34{
35
36}
Note: See TracBrowser for help on using the repository browser.