Skip to content

Commit 8068268

Browse files
authored
Update AnalogRead_DigitalRead.ino
Wait for serial port to connect. Needed for native USB, on LEONARDO, MICRO, YUN, and other 32u4 based boards. Thanks to @SalvorinFex for testing these boards.
1 parent f44a556 commit 8068268

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

examples/AnalogRead_DigitalRead/AnalogRead_DigitalRead.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ void setup() {
1414

1515
// initialize serial communication at 9600 bits per second:
1616
Serial.begin(9600);
17+
18+
while (!Serial) {
19+
; // wait for serial port to connect. Needed for native USB, on LEONARDO, MICRO, YUN, and other 32u4 based boards.
20+
}
1721

1822
// Semaphores are useful to stop a Task proceeding, where it should be paused to wait,
1923
// because it is sharing a resource, such as the Serial port.

0 commit comments

Comments
 (0)