Skip to content

Commit 7575244

Browse files
committed
examples: uniform initialization error messages
1 parent 82604ad commit 7575244

5 files changed

Lines changed: 13 additions & 7 deletions

File tree

examples/Central/LedControl/LedControl.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ void setup() {
3030
pinMode(buttonPin, INPUT);
3131

3232
// initialize the Bluetooth® Low Energy hardware
33-
BLE.begin();
33+
if (!BLE.begin()) {
34+
Serial.println("starting Bluetooth® Low Energy module failed!");
35+
36+
while (1);
37+
}
3438

3539
Serial.println("Bluetooth® Low Energy Central - LED control");
3640

examples/Peripheral/Advertising/EnhancedAdvertising/EnhancedAdvertising.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ void setup() {
1212
while (!Serial);
1313

1414
if (!BLE.begin()) {
15-
Serial.println("failed to initialize BLE!");
15+
Serial.println("starting Bluetooth® Low Energy module failed!");
16+
1617
while (1);
1718
}
1819

examples/Peripheral/Advertising/RawDataAdvertising/RawDataAdvertising.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ void setup() {
1111
while (!Serial);
1212

1313
if (!BLE.begin()) {
14-
Serial.println("failed to initialize BLE!");
14+
Serial.println("starting Bluetooth® Low Energy module failed!");
15+
1516
while (1);
1617
}
1718

examples/Peripheral/BatteryMonitor/BatteryMonitor.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void setup() {
3535

3636
// begin initialization
3737
if (!BLE.begin()) {
38-
Serial.println("starting BLE failed!");
38+
Serial.println("starting Bluetooth® Low Energy module failed!");
3939

4040
while (1);
4141
}

examples/Peripheral/EncryptedBatteryMonitor/EncryptedBatteryMonitor.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ void setup() {
154154
while(1){
155155
// begin initialization
156156
if (!BLE.begin()) {
157-
Serial.println("starting BLE failed!");
158-
delay(200);
159-
continue;
157+
Serial.println("starting Bluetooth® Low Energy module failed!");
158+
159+
while (1);
160160
}
161161
Serial.println("BT init");
162162
delay(200);

0 commit comments

Comments
 (0)