2
2
Standby Wake from RTC Demo for Portenta C33
3
3
4
4
This example demonstrates how to wake up the Portenta C33 from standby mode using the included RTC (Real Time Clock).
5
- The device will go to sleep for 1 second and then wake up. When the device is awake you will see the board's blue LED turned on.
5
+ The device will go to sleep for 5 seconds and then wake up. When the device is awake you will see the board's built-in LED turned on.
6
6
Effectively, you will get the same effect as with blink.
7
7
8
8
On the Portenta C33 with the peripherals turned off you can expect around 60uA of current consumption in standby mode.
@@ -35,7 +35,7 @@ void blinkLed(int ledPin, int delayTime = 1000){
35
35
void setup () {
36
36
pinMode (LEDR, OUTPUT); // Used to indicate errors
37
37
digitalWrite (LEDR, HIGH); // Turn off the red LED
38
- pinMode (LEDB , OUTPUT); // Used to indicate that the board is awake
38
+ pinMode (LED_BUILTIN , OUTPUT); // Used to indicate that the board is awake
39
39
40
40
if (!board.begin ()){
41
41
while (true ){
@@ -44,19 +44,21 @@ void setup() {
44
44
}
45
45
46
46
board.setAllPeripheralsPower (true );
47
- digitalWrite (LEDB , LOW); // Turn on the blue LED to show that the board is still awake
47
+ digitalWrite (LED_BUILTIN , LOW); // Turn on the LED to show that the board is awake
48
48
49
49
RTC.begin ();
50
50
if (!RTC.isRunning ()) {
51
+ // The initial time is a dummy time
52
+ // You could also get the actual time from an NTP server or from a user input
51
53
if (!RTC.setTime (initialTime)){
52
54
while (true ){
53
55
blinkLed (LEDR);
54
56
}
55
57
}
56
58
}
57
59
58
- delay (10000 ); // Keep the board awake for 10 seconds, so we can se it working
59
- board.enableWakeupFromRTC (0 , 0 , 10 ); // Sleep for 10 seconds
60
+ delay (5000 ); // Keep the board awake for 5 seconds, so we can se it working
61
+ board.enableWakeupFromRTC (0 , 0 , 5 ); // Sleep for 5 seconds
60
62
61
63
board.shutDownFuelGauge ();
62
64
board.setAllPeripheralsPower (false );
0 commit comments