Pages: [1]   Go Down
Author Topic: Leonardo doesn't talk to serial monitor  (Read 1504 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have tried with two leonardos to get some serial I/O with the monitor and so far nothing. I can upload programs (blink, etc). When I upload the following with the while enabled, I get nothing--no serial output, no blinking. If I comment out the while, the led blinks. Any suggestions? (besides going back to the uno)
Code:
//Leonardo test 1 -- check serial i/o

void setup(){
  Serial.begin(9600);
  pinMode(13,OUTPUT);
//  while(!Serial);
}

void loop(){
  int i;
  Serial.println("Ready:");
  for(i=1;i<11;i++) {
    digitalWrite(13,HIGH);
    delay(500);
    Serial.println(i);
    digitalWrite(13,LOW);
    delay(200);
  }
}
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The example code for the Leonardo serial port requires you to wait, for example:

Code:
//Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial)  { }

Add in the line after Serial.begin and it should work better.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Already tried it. It still doesn't work. Whenever the while is enabled, the program never gets out of setup. Yet comm is okay since I can upload programs. I am at a loss.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try a higher baud rate? I am using 115200 with mine. It gets converted into USB anyway.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Tried higher baud rate, still nothing. I am going to try an xp machine (this has been on Windows 7 up to now)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

UPDATE
The leonardo talks to the serial monitor on an XP machine. So my question is now: How do I get it to talk the serail monitor on my windows 7 machine????
Logged

0
Offline Offline
Jr. Member
**
Karma: 4
Posts: 65
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you need brackets after this line?

your code above

while(!Serial);

like this instead

while(!Serial){}

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It works either way. In any case, the problem appears to be with windows 7. The leonardo communicates with an XP laptop, but not windows 7 via the serial monitor. I can upload to it with Win 7.
Logged

Florida
Offline Offline
Sr. Member
****
Karma: 4
Posts: 431
hookedup!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This may sound odd, but try changing this setting in your Serial object in your application:
RtsEnable =True
and try again.

I found the same issue on my (arg - Vista) machine, where it would work fine when talking with the Arduino serial monitor, but not my application.  I created a simple print and receive set of apps, and they didnt work.  I then updated the RtsEnable setting and amazed it started working.

Hope that helps
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
This may sound odd, but try changing this setting in your Serial object in your application:
RtsEnable =True
and try again.
I'm not sure it applies. The problem is between the leonardo and the arduino serial monitor. Where would I put the code you suggest? It looks like code for an external program. Agian it is apparently a Windows 7 problem because I can see the leonado in XP.
Logged

Florida
Offline Offline
Sr. Member
****
Karma: 4
Posts: 431
hookedup!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ah - in my case the serial monitor was working, just not my application.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am going to start a new thread to be more specific. Please look for that thread and do not answer this one. Thanks
Logged

Pages: [1]   Go Up
Jump to: