From c4fe926de9d37daa4b8de01510483f2c37c462ec Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 27 Sep 2017 15:50:58 +0700 Subject: [PATCH] update beacon.ino to suspend loop() --- .../examples/Peripheral/beacon/beacon.ino | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libraries/Bluefruit52Lib/examples/Peripheral/beacon/beacon.ino b/libraries/Bluefruit52Lib/examples/Peripheral/beacon/beacon.ino index 1b14b8e4..36919eb4 100644 --- a/libraries/Bluefruit52Lib/examples/Peripheral/beacon/beacon.ino +++ b/libraries/Bluefruit52Lib/examples/Peripheral/beacon/beacon.ino @@ -40,7 +40,8 @@ void setup() Bluefruit.begin(); // Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4 - Bluefruit.setTxPower(4); + Bluefruit.autoConnLed(false); + Bluefruit.setTxPower(0); Bluefruit.setName("Bluefruit52"); // Manufacturer ID is required for Manufacturer Specific Data @@ -50,6 +51,9 @@ void setup() startAdv(); Serial.println("Broadcasting beacon, open your beacon app to test"); + + // Suspend Loop() to save power, since we didn't have any code there + suspendLoop(); } void startAdv(void) @@ -81,8 +85,6 @@ void startAdv(void) void loop() { - // Toggle both LEDs every second - digitalToggle(LED_RED); - delay(1000); + // loop is already suspended, CPU will not run loop() at all }