Skip to content

Commit f132b80

Browse files
committed
Added more comments about while(!Serial)
-This can prevent code from running, if the user does not plug in a USB cable and allow it to enumerate a com port. So hopefully this extra comment will help them out.
1 parent c7d645e commit f132b80

File tree

21 files changed

+105
-21
lines changed

21 files changed

+105
-21
lines changed

examples/Example_01_RotationVector/Example_01_RotationVector.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,12 @@ BNO08x myIMU;
6060

6161
void setup() {
6262
Serial.begin(115200);
63+
6364
while(!Serial) delay(10); // Wait for Serial to become available.
64-
// Necessary for boards with native USB (like the SAMD51 Thing+).
65+
// Necessary for boards with native USB (like the SAMD51 Thing+).
66+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
67+
// Comment out this while loop, or it will prevent the remaining code from running.
68+
6569
Serial.println();
6670
Serial.println("BNO08x Read Example");
6771

examples/Example_02_Accelerometer/Example_02_Accelerometer.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ BNO08x myIMU;
5959

6060
void setup() {
6161
Serial.begin(115200);
62+
6263
while(!Serial) delay(10); // Wait for Serial to become available.
63-
// Necessary for boards with native USB (like the SAMD51 Thing+).
64+
// Necessary for boards with native USB (like the SAMD51 Thing+).
65+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
66+
// Comment out this while loop, or it will prevent the remaining code from running.
67+
6468
Serial.println();
6569
Serial.println("BNO08x Read Example");
6670

examples/Example_03_Gyro/Example_03_Gyro.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,12 @@ BNO08x myIMU;
6060

6161
void setup() {
6262
Serial.begin(115200);
63+
6364
while(!Serial) delay(10); // Wait for Serial to become available.
64-
// Necessary for boards with native USB (like the SAMD51 Thing+).
65+
// Necessary for boards with native USB (like the SAMD51 Thing+).
66+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
67+
// Comment out this while loop, or it will prevent the remaining code from running.
68+
6569
Serial.println();
6670
Serial.println("BNO08x Read Example");
6771

examples/Example_04_Magnetometer/Example_04_Magnetometer.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,12 @@ BNO08x myIMU;
6060

6161
void setup() {
6262
Serial.begin(115200);
63+
6364
while(!Serial) delay(10); // Wait for Serial to become available.
64-
// Necessary for boards with native USB (like the SAMD51 Thing+).
65+
// Necessary for boards with native USB (like the SAMD51 Thing+).
66+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
67+
// Comment out this while loop, or it will prevent the remaining code from running.
68+
6569
Serial.println();
6670
Serial.println("BNO08x Read Example");
6771

examples/Example_05_StepCounter/Example_05_StepCounter.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ BNO08x myIMU;
5959

6060
void setup() {
6161
Serial.begin(115200);
62+
6263
while(!Serial) delay(10); // Wait for Serial to become available.
63-
// Necessary for boards with native USB (like the SAMD51 Thing+).
64+
// Necessary for boards with native USB (like the SAMD51 Thing+).
65+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
66+
// Comment out this while loop, or it will prevent the remaining code from running.
67+
6468
Serial.println();
6569
Serial.println("BNO08x Read Example");
6670

examples/Example_06_StabilityClassifier/Example_06_StabilityClassifier.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,12 @@ BNO08x myIMU;
6060

6161
void setup() {
6262
Serial.begin(115200);
63+
6364
while(!Serial) delay(10); // Wait for Serial to become available.
64-
// Necessary for boards with native USB (like the SAMD51 Thing+).
65+
// Necessary for boards with native USB (like the SAMD51 Thing+).
66+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
67+
// Comment out this while loop, or it will prevent the remaining code from running.
68+
6569
Serial.println();
6670
Serial.println("BNO08x Read Example");
6771

examples/Example_07_ActivityClassifier/Example_07_ActivityClassifier.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,12 @@ BNO08x myIMU;
7070

7171
void setup() {
7272
Serial.begin(115200);
73+
7374
while(!Serial) delay(10); // Wait for Serial to become available.
74-
// Necessary for boards with native USB (like the SAMD51 Thing+).
75+
// Necessary for boards with native USB (like the SAMD51 Thing+).
76+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
77+
// Comment out this while loop, or it will prevent the remaining code from running.
78+
7579
Serial.println();
7680
Serial.println("BNO08x Read Example");
7781

examples/Example_08_AdvancedConfig/Example_08_AdvancedConfig.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,12 @@ BNO08x myIMU;
7272

7373
void setup() {
7474
Serial.begin(115200);
75+
7576
while(!Serial) delay(10); // Wait for Serial to become available.
76-
// Necessary for boards with native USB (like the SAMD51 Thing+).
77+
// Necessary for boards with native USB (like the SAMD51 Thing+).
78+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
79+
// Comment out this while loop, or it will prevent the remaining code from running.
80+
7781
Serial.println();
7882
Serial.println("BNO08x Read Example");
7983

examples/Example_09_LinearAccelerometer/Example_09_LinearAccelerometer.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,12 @@ BNO08x myIMU;
6060

6161
void setup() {
6262
Serial.begin(115200);
63+
6364
while(!Serial) delay(10); // Wait for Serial to become available.
64-
// Necessary for boards with native USB (like the SAMD51 Thing+).
65+
// Necessary for boards with native USB (like the SAMD51 Thing+).
66+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
67+
// Comment out this while loop, or it will prevent the remaining code from running.
68+
6569
Serial.println();
6670
Serial.println("BNO08x Read Example");
6771

examples/Example_10_TimeStamp/Example_10_TimeStamp.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,12 @@ BNO08x myIMU;
6262

6363
void setup() {
6464
Serial.begin(115200);
65+
6566
while(!Serial) delay(10); // Wait for Serial to become available.
66-
// Necessary for boards with native USB (like the SAMD51 Thing+).
67+
// Necessary for boards with native USB (like the SAMD51 Thing+).
68+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
69+
// Comment out this while loop, or it will prevent the remaining code from running.
70+
6771
Serial.println();
6872
Serial.println("BNO08x Read Example");
6973

examples/Example_11_RawReadings/Example_11_RawReadings.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,12 @@ uint16_t mz;
8080

8181
void setup() {
8282
Serial.begin(115200);
83+
8384
while(!Serial) delay(10); // Wait for Serial to become available.
84-
// Necessary for boards with native USB (like the SAMD51 Thing+).
85+
// Necessary for boards with native USB (like the SAMD51 Thing+).
86+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
87+
// Comment out this while loop, or it will prevent the remaining code from running.
88+
8589
Serial.println();
8690
Serial.println("BNO08x Read Example");
8791

examples/Example_12_GyroIntegratedRotationVector/Example_12_GyroIntegratedRotationVector.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,12 @@ BNO08x myIMU;
6666

6767
void setup() {
6868
Serial.begin(115200);
69+
6970
while(!Serial) delay(10); // Wait for Serial to become available.
70-
// Necessary for boards with native USB (like the SAMD51 Thing+).
71+
// Necessary for boards with native USB (like the SAMD51 Thing+).
72+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
73+
// Comment out this while loop, or it will prevent the remaining code from running.
74+
7175
Serial.println();
7276
Serial.println("BNO08x Read Example");
7377

examples/Example_13_EulerAngles/Example_13_EulerAngles.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,12 @@ BNO08x myIMU;
6767

6868
void setup() {
6969
Serial.begin(115200);
70+
7071
while(!Serial) delay(10); // Wait for Serial to become available.
71-
// Necessary for boards with native USB (like the SAMD51 Thing+).
72+
// Necessary for boards with native USB (like the SAMD51 Thing+).
73+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
74+
// Comment out this while loop, or it will prevent the remaining code from running.
75+
7276
Serial.println();
7377
Serial.println("BNO08x Read Example");
7478

examples/Example_14_Tare/Example_14_Tare.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,12 @@ BNO08x myIMU;
6666

6767
void setup() {
6868
Serial.begin(115200);
69+
6970
while(!Serial) delay(10); // Wait for Serial to become available.
70-
// Necessary for boards with native USB (like the SAMD51 Thing+).
71+
// Necessary for boards with native USB (like the SAMD51 Thing+).
72+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
73+
// Comment out this while loop, or it will prevent the remaining code from running.
74+
7175
Serial.println();
7276
Serial.println("BNO08x Read Example");
7377

examples/Example_15_Gravity/Example_15_Gravity.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,12 @@ BNO08x myIMU;
6262

6363
void setup() {
6464
Serial.begin(115200);
65+
6566
while(!Serial) delay(10); // Wait for Serial to become available.
66-
// Necessary for boards with native USB (like the SAMD51 Thing+).
67+
// Necessary for boards with native USB (like the SAMD51 Thing+).
68+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
69+
// Comment out this while loop, or it will prevent the remaining code from running.
70+
6771
Serial.println();
6872
Serial.println("BNO08x Read Example");
6973

examples/Example_16_UncalibratedGyro/Example_16_UncalibratedGyro.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,12 @@ BNO08x myIMU;
6060

6161
void setup() {
6262
Serial.begin(115200);
63+
6364
while(!Serial) delay(10); // Wait for Serial to become available.
64-
// Necessary for boards with native USB (like the SAMD51 Thing+).
65+
// Necessary for boards with native USB (like the SAMD51 Thing+).
66+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
67+
// Comment out this while loop, or it will prevent the remaining code from running.
68+
6569
Serial.println();
6670
Serial.println("BNO08x Read Example");
6771

examples/Example_17_ResetCheck/Example_17_ResetCheck.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,12 @@ int cyclecount = 0;
6565

6666
void setup() {
6767
Serial.begin(115200);
68+
6869
while(!Serial) delay(10); // Wait for Serial to become available.
69-
// Necessary for boards with native USB (like the SAMD51 Thing+).
70+
// Necessary for boards with native USB (like the SAMD51 Thing+).
71+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
72+
// Comment out this while loop, or it will prevent the remaining code from running.
73+
7074
Serial.println();
7175
Serial.println("BNO08x Read Example");
7276

examples/Example_18_Sleep/Example_18_Sleep.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,12 @@ bool lastPowerState = true; // Toggle between "On" and "Sleep"
6868

6969
void setup() {
7070
Serial.begin(115200);
71+
7172
while(!Serial) delay(10); // Wait for Serial to become available.
72-
// Necessary for boards with native USB (like the SAMD51 Thing+).
73+
// Necessary for boards with native USB (like the SAMD51 Thing+).
74+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
75+
// Comment out this while loop, or it will prevent the remaining code from running.
76+
7377
Serial.println();
7478
Serial.println("BNO08x Sleep Example");
7579

examples/SPI/Example_01_SPI_RotationVector/Example_01_SPI_RotationVector.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,12 @@ BNO08x myIMU;
6565

6666
void setup() {
6767
Serial.begin(115200);
68+
6869
while(!Serial) delay(10); // Wait for Serial to become available.
69-
// Necessary for boards with native USB (like the SAMD51 Thing+).
70+
// Necessary for boards with native USB (like the SAMD51 Thing+).
71+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
72+
// Comment out this while loop, or it will prevent the remaining code from running.
73+
7074
Serial.println();
7175
Serial.println("BNO08x Read Example");
7276

examples/SPI/Example_02_SPI_ResetCheck/Example_02_SPI_ResetCheck.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,12 @@ int cyclecount = 0;
6868

6969
void setup() {
7070
Serial.begin(115200);
71+
7172
while(!Serial) delay(10); // Wait for Serial to become available.
72-
// Necessary for boards with native USB (like the SAMD51 Thing+).
73+
// Necessary for boards with native USB (like the SAMD51 Thing+).
74+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
75+
// Comment out this while loop, or it will prevent the remaining code from running.
76+
7377
Serial.println();
7478
Serial.println("BNO08x Read Example");
7579

examples/SPI/Example_03_SPI_Sleep/Example_03_SPI_Sleep.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,12 @@ bool lastPowerState = true; // Toggle between "On" and "Sleep"
6363

6464
void setup() {
6565
Serial.begin(115200);
66+
6667
while(!Serial) delay(10); // Wait for Serial to become available.
67-
// Necessary for boards with native USB (like the SAMD51 Thing+).
68+
// Necessary for boards with native USB (like the SAMD51 Thing+).
69+
// For a final version of a project that does not need serial debug (or a USB cable plugged in),
70+
// Comment out this while loop, or it will prevent the remaining code from running.
71+
6872
Serial.println();
6973
Serial.println("BNO08x Sleep Example");
7074

0 commit comments

Comments
 (0)