Skip to content

Commit 580c76b

Browse files
committed
Rename sketch
1 parent 554f70f commit 580c76b

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

examples/WakeFromGPIO/WakeFromGPIO.ino renamed to examples/WakeFromPin/WakeFromPin.ino

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/*
22
********************************************************************************
3-
* WakeFromGPIO.ino
43
*
54
* This example demonstrates how to wake up the Portenta C33 from deep sleep using a GPIO pin.
65
* The pin can be configured to wake up the device on a rising or falling edge, but not all pins are supported.
@@ -12,7 +11,7 @@
1211
*
1312
* The example also demonstrates how to use the PF1550 PMIC to turn off the peripherals
1413
* before going to sleep and turn them back on after waking up.
15-
* uncomment #define TURN_PERIPHERALS_OFF on line 28 to enable this feature.
14+
* uncomment #define TURN_PERIPHERALS_OFF on line 33 to enable this feature.
1615
*
1716
* When the device is not sleeping it will blink the built-in LED every 100ms.
1817
*
@@ -31,8 +30,8 @@
3130
#include "Arduino_LowPowerPortentaC33.h"
3231

3332
// #define TURN_PERIPHERALS_OFF
34-
#define SLEEP_PIN 0
35-
#define WAKE_PIN A3
33+
#define SLEEP_PIN 0 // Pin used to put the device to sleep
34+
#define WAKE_PIN A3 // Pin used to wake up the device
3635

3736
LowPower lowPower;
3837

@@ -59,12 +58,16 @@ LowPower lowPower;
5958
#endif
6059

6160
void goToSleep(){
62-
turnPeripheralsOff();
61+
#ifdef TURN_PERIPHERALS_OFF
62+
turnPeripheralsOff();
63+
#endif
6364
lowPower.deepSleep();
6465
}
6566

6667
void setup(){
6768
lowPower = LowPower();
69+
70+
// Register the callback function to put the device to sleep when the button is pressed
6871
attachInterrupt(digitalPinToInterrupt(SLEEP_PIN), goToSleep, RISING);
6972
lowPower.enableWakeupFromPin(WAKE_PIN, RISING);
7073
pinMode(LED_BUILTIN, OUTPUT);
@@ -76,10 +79,11 @@ void setup(){
7679
}
7780

7881
void loop(){
82+
// Blink the built-in LED every 500ms when the device is not sleeping
7983
digitalWrite(LED_BUILTIN, HIGH);
80-
delay(100);
84+
delay(500);
8185
digitalWrite(LED_BUILTIN, LOW);
82-
delay(100);
86+
delay(500);
8387
}
8488

8589

0 commit comments

Comments
 (0)