You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: libraries/Bluefruit52Lib/examples/Hardware/blink_sleep/blink_sleep.ino
+7-3Lines changed: 7 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
/*
2
2
Blink_sleep
3
3
Turns on an LED on for one second, then off for one second, until the time to go to sleep runs out.
4
+
You can wake up the feather by pressing a key/switch connecting the WAKE_LOW_PIN to GND and the WAKE_HIGH_PIN to 3.3V (VCC)
4
5
5
6
Based on the blinky arduino example
6
7
@@ -10,6 +11,7 @@
10
11
by Pierre Constantineau
11
12
12
13
*/
14
+
#include<bluefruit.h>
13
15
14
16
#defineWAKE_LOW_PIN PIN_A0
15
17
#defineWAKE_HIGH_PIN PIN_A1
@@ -22,11 +24,11 @@ void gotoSleep(unsigned long time)
22
24
if ((time>SLEEPING_DELAY))
23
25
{
24
26
// to reduce power consumption when sleeping, turn off all your LEDs (and other power hungry devices)
25
-
digitalwrite(LED_BUILTIN, LOW);
27
+
digitalWrite(LED_BUILTIN, LOW);
26
28
27
29
// setup your wake-up pins.
28
-
pinModeSense(WAKE_LOW_PIN, INPUT_PULLUP_SENSE); // this pin (WAKE_LOW_PIN) is pulled up and wakes up the feather when externally connected to ground.
29
-
pinModeSense(WAKE_HIGH_PIN, INPUT_PULLDOWN_SENSE); // this pin (WAKE_HIGH_PIN) is pulled down and wakes up the feather when externally connected to 3.3v.
30
+
pinMode(WAKE_LOW_PIN, INPUT_PULLUP_SENSE); // this pin (WAKE_LOW_PIN) is pulled up and wakes up the feather when externally connected to ground.
31
+
pinMode(WAKE_HIGH_PIN, INPUT_PULLDOWN_SENSE); // this pin (WAKE_HIGH_PIN) is pulled down and wakes up the feather when externally connected to 3.3v.
30
32
31
33
// power down nrf52.
32
34
sd_power_system_off(); // this function puts the whole nRF52 to deep sleep (no Bluetooth). If no sense pins are setup (or other hardware interrupts), the nrf52 will not wake up.
@@ -35,6 +37,8 @@ void gotoSleep(unsigned long time)
35
37
36
38
// the setup function runs once when you press reset or power the board
37
39
voidsetup() {
40
+
Bluefruit.begin(); // Sleep functions need the softdevice to be active.
41
+
38
42
// initialize digital pin LED_BUILTIN as an output.
0 commit comments