Last change
on this file since 286 was 136, checked in by ertl-honda, 9 years ago |
ライブラリとOS及びベーシックなサンプルの追加.
|
File size:
1000 bytes
|
Line | |
---|
1 | /*********************************************************************************************************************************************************************************
|
---|
2 | * This sketch demonstrates how sleep function using external interrupt to wake up the MCU.
|
---|
3 | This sketch work only for M0 or M0PRO boards.
|
---|
4 | *********************************************************************************************************************************************************************************/
|
---|
5 |
|
---|
6 |
|
---|
7 |
|
---|
8 | #include <rest.h>
|
---|
9 |
|
---|
10 | rest mcu_std;
|
---|
11 |
|
---|
12 | unsigned int i=0;
|
---|
13 |
|
---|
14 | void setup()
|
---|
15 | {
|
---|
16 |
|
---|
17 | //SerialUSB.begin(9600); //serial settings
|
---|
18 | mcu_std.begin(WAKE_EXT_INTERRUPT,8,prova); //standby setup for external interrupts
|
---|
19 |
|
---|
20 |
|
---|
21 | }
|
---|
22 |
|
---|
23 | void loop()
|
---|
24 | {
|
---|
25 | for(i=0; i<20; i++)
|
---|
26 | {
|
---|
27 | digitalWrite(13,HIGH);
|
---|
28 | delay(100);
|
---|
29 | digitalWrite(13,LOW);
|
---|
30 | delay(500);
|
---|
31 | }
|
---|
32 |
|
---|
33 | mcu_std.standby(); //now mcu go to standby
|
---|
34 |
|
---|
35 | }
|
---|
36 |
|
---|
37 |
|
---|
38 | void prova(void) //interrupt routine (isn't necessary to execute any tasks in this routine
|
---|
39 | {
|
---|
40 |
|
---|
41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.