Each time you open the Arduino serial monitor window with the Arduino's serial port selected, the Arduino should reset. Does it do that?
Serial re-enumeration on reset.Since the Leonardo does not have a dedicated chip to handle serial communication, it means that the serial port is virtual -- it's a software routine, both on your operating system, and on the Leonardo itself. Just as your computer creates an instance of the serial port driver when you plug in any Arduino, the Leonardo creates a serial instance whenever it runs its bootloader. The Leonardo is an instance of USB's Connected Device Class (CDC) driver. This means that every time you reset the board, the Leonardo's USB serial connection will be broken and re-established. The Leonardo will disappear from the list of serial ports, and the list will re-enumerate. Any program that has an open serial connection to the Leonardo will lose its connection. This is in contrast to the Arduino Uno, with which you can reset the main processor (the ATmega328P) without closing the USB connection (which is maintained by the secondary ATmega8U2 or ATmega16U2 processor). This difference has implications for driver installation, uploading, and communication; these are discussed below. No reset when you open the serial port.Unlike the Arduino Uno, the Leonardo doesn't restart your sketch when you open its serial port on the computer. That means you won't see serial data that's already been sent to the computer by the board, including, for example, most data sent in the setup() function. This change means that if you're using any Serial print(), println() or write() statments in your setup, they won't show up when you open the serial monitor. To work around this, you can check to see if the serial port is open like so: // while the serial stream is not open, do nothing: while (!Serial) ;
Except on the Leonardo, if I remember correctly.
No reset when you open the serial port.Unlike the Arduino Uno, the Leonardo doesn't restart your sketch when you open its serial port on the computer. That means you won't see serial data that's already been sent to the computer by the board, including, for example, most data sent in the setup() function.
while (!Serial) ;
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16