I recently purchased a sainsmart Leonardo and I am aware it does not have a dedicated chip to handle serial communication, so when the serial monitor is open the sketch isn't restarted. I'm not exactly sure why I am not getting a read out in the serial monitor. also if it helps when I locate the Leonardo in the devices window it is listed as being in the mouses and keyboard category.
chip- atmel- MEGA32U4
os- windows 7
connected via usb
here is the code and the baud rate set to the Leonardo and the serial monitor.
** // while the serial stream is not open, do nothing:**
** while (!Serial) ; // this is used to ensure connection to serial port i think**
** Serial.println("Hello World!");**
Please show the whole sketch, between [code] … [/code] tags.
Could you try this:
Close the serial monitor. Upload the sketch. Wait a few seconds for the Leonardo to start running. Open the serial monitor. Do you see the text ?
This code: “
while (!Serial) ;” waits until the serial monitor is opened (only on the Leonardo).
If you don’t use that line, you won’t see any output.
This code: "while (!Serial) ;" waits until the serial monitor is opened (only on the Leonardo).
If you don't use that line, you won't see any output.
This information is not correct. It waits until the processor has sucessfully attached to the USB bus as a serial device. If your information was correct, a Leonardo with that code would not start the sketch until a serial monitor is opened, which is not true.
Try to add some serial output in the loop(), you might get too late to open the serial monitor to catch that first output.
I’m sorry. pylon, you are right.
I used this test sketch:
// Arduino Leonard test sketch
// while the serial stream is not open, do nothing.
while (!Serial) ;
pinMode( 13, OUTPUT);
Serial.print("Counting : ");
for( int i=0; i<5; i++)
digitalWrite( 13, HIGH);
digitalWrite( 13, LOW);