No information on serial monitor from Leonardo

Hi all,

I'm an absolute newby in Arduino and the programming language. And that is why I need the serial monitor to work. Easy to see variables and so on. But no luck. I tried the sketch below and the void loop only starts when I comment out while (!serial).

I'm using IDE 1.0.4. and Windows 7. Any idea's?

int led = 13;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
Serial.begin(9600);
digitalWrite(led, HIGH);
//while (!Serial) ;
Serial.println("Test");
}

// the loop routine runs over and over again forever:
void loop() {
Serial.println("High");
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
Serial.println("Low");
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
}

I tried the sketch below and the void loop only starts when I comment out while (!serial).

Usually, the while loop is waiting for Serial1 to start on the Leonardo. Why did you remove the 1?

To my knowledge serial is the USB port and serial1 the port to the shield on pins Tx1 and Rx1. As I want to see debugging info in the serial monitor I thought I needed serial. Strange thing is that the sketch simply stops at the while statement. Apparently because the serial port is not connected, but why?

To my knowledge serial is the USB port and serial1 the port to the shield on pins Tx1 and Rx1.

Yes, and the USB port is already awake and performing when setup() is called. After all, the bootloader already took care of that. The Serial1 instance is not. You need to wait for that to be ready.

Yes everything seems to work (when while is commented out), however no information is displayed in the serial monitor. If I manually enter information in the monitor and press send I can see the led RX on the Leo lighting up. However I never see the LED TX is going on.

I sometimes find the Leonardo temperamental to use with the Serial monitor compared with the Uno. I prefer the Uno because starting the Serial monitor restarts the program, but that might not always be what you want. Make sure that you set the Serial monitor baud rate to 9600 to match the program, but the TX LED should flash anyway, as should the LED in pin 13

Your program works for me on Windows 7, IDE 1.0.4 with a Leonardo.

Hi all,

Update: well I got things working. I'm now using Putty as a terminal program and that does the job. Obviously I need to stop Putty if I want to upload a sketch to the Leo, but that is something I van live with.

Thanks for all help