Ryan
Ryan

Reputation: 5

Opening serial monitor changes Arduino pin state

I am programming an Arduino Uno. The board is connected to my PC via USB cable. I run the following code with pin 8 wired to an external LED. The program boots and the LED turns on.

Code

If I open the serial monitor in the Arduino IDE, the LED turns off for ~2 seconds and then turns on again.

Why would opening the serial monitor affect the state of the pins on the Arduino? Is the chip faulty or am I missing something obvious?

Upvotes: 0

Views: 210

Answers (1)

Sanvir Dessai
Sanvir Dessai

Reputation: 26

By default, arduino boards will reset whenever a serial connection is established with them. So when the IDE is started, a new serial conection is established, which restarts the program, causing ~2 seconds of 'down time'. It is possible to disable this setting https://playground.arduino.cc/Main/DisablingAutoResetOnSerialConnection

Upvotes: 1

Related Questions