Skip to content

Commit d0f5d28

Browse files
committed
Simplify examples
1 parent ff125ed commit d0f5d28

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

Diff for: examples/Standby_WakeFromRTC_C33/Standby_WakeFromRTC_C33.ino

+7-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Standby Wake from RTC Demo for Portenta C33
33
44
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.
66
Effectively, you will get the same effect as with blink.
77
88
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){
3535
void setup() {
3636
pinMode(LEDR, OUTPUT); // Used to indicate errors
3737
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
3939

4040
if(!board.begin()){
4141
while (true){
@@ -44,19 +44,21 @@ void setup() {
4444
}
4545

4646
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
4848

4949
RTC.begin();
5050
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
5153
if(!RTC.setTime(initialTime)){
5254
while (true){
5355
blinkLed(LEDR);
5456
}
5557
}
5658
}
5759

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
6062

6163
board.shutDownFuelGauge();
6264
board.setAllPeripheralsPower(false);

Diff for: examples/Standby_WakeFromRTC_H7/Standby_WakeFromRTC_H7.ino

+1-8
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,8 @@ void setup() {
4141
pinMode(LEDR, OUTPUT); // Used to indicate errors
4242
digitalWrite(LEDR, HIGH); // Turn off the red LED
4343
pinMode(LED_BUILTIN, OUTPUT);
44-
digitalWrite(LED_BUILTIN, HIGH); // Turn off the built-in LED
45-
pinMode(LEDB, OUTPUT); // Used to indicate that the board is awake
44+
digitalWrite(LED_BUILTIN, LOW); // Turn on the built-in LED to show that the board is awake
4645

47-
// Turn on the blue LED to show that the board is still awake
48-
digitalWrite(LEDB, LOW);
49-
50-
5146
if(!board.begin()){
5247
// If the board fails to initialize, it will blink the red LED
5348
while (true){
@@ -58,8 +53,6 @@ void setup() {
5853
delay(10000); // keep the board awake for 10 seconds, so we can se it working
5954
board.shutDownFuelGauge();
6055

61-
62-
6356
// The LED should go off when the board goes to sleep
6457
board.setAllPeripheralsPower(false);
6558

0 commit comments

Comments
 (0)