Reputation: 103
I am using Arduino nano 33 IoT and currently my Arduino stops running even the loop function after unplug&Replug into the computer without reprogramming or pressing the reset button. Any suggestions for resolving this issue?
Sample Code: The follow code stops printing "hello" to the serial port after unplugging and re-plugging or pressing the reset button on board.
void setup() {
// initialize digital pin LED_BUILTIN as an output.
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
while (!Serial);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
Serial.println("hello");
}
Upvotes: 0
Views: 390
Reputation: 103
I found the solution:
while (!Serial);
Upvotes: 0