File tree Expand file tree Collapse file tree 1 file changed +27
-8
lines changed
examples/DeepSleep_WakeFromRTC_H7 Expand file tree Collapse file tree 1 file changed +27
-8
lines changed Original file line number Diff line number Diff line change 1- #include " Arduino.h"
21#include " Arduino_PowerManagement.h"
32
43Board board;
54
6-
75void setup () {
86 board = Board ();
7+
8+ // When uploading this sketch to the M4 core, it just goes to standby mode.
9+ #if defined(ARDUINO_GENERIC_STM32H747_M4)
10+ board.standByUntilWakeupEvent ();
11+ return ;
12+ #endif
13+
14+ // Turn off the built-in LED
15+ pinMode (LED_BUILTIN, OUTPUT);
16+ digitalWrite (LED_BUILTIN, HIGH);
17+
18+ // Turn on the blue LED to show that the board is still awake
19+ pinMode (LEDB, OUTPUT);
20+ digitalWrite (LEDB, LOW);
21+
922 if (!board.begin ()){
10- Serial.println (" Board initialization failed." );
11- while (true );
23+ // If the board fails to initialize, it will blink the red LED
24+ pinMode (LEDR, OUTPUT);
25+ while (true ){
26+ digitalWrite (LEDR, LOW);
27+ delay (1000 );
28+ digitalWrite (LEDR, HIGH);
29+ delay (1000 );
30+ }
1231 }
13- board.enableWakeupFromRTC ();
14- board.sleepFor (0 , 0 , 1 );
1532
16- pinMode (LEDB, OUTPUT);
17- digitalWrite (LEDB, LOW);
33+
34+ board.enableWakeupFromRTC (0 , 0 , 10 ); // Sleep for 10 seconds
35+
36+ // The LED should go off when the board goes to sleep
1837 board.setAllPeripheralsPower (false );
1938 board.standByUntilWakeupEvent ();
2039}
You can’t perform that action at this time.
0 commit comments