Pages: [1]   Go Down
Author Topic: while (!Serial) needed for Arduino Micro?  (Read 97 times)
0 Members and 1 Guest are viewing this topic.
Central MN, USA
Offline Offline
Tesla Member
***
Karma: 76
Posts: 7305
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I just got an Arduino Micro. I remember that you need the following for arduino Leonardo:

Code:
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only

Is this also needed for Micro since Micro uses the same 32U4? Thanks.

I tested printing stuff from Micro to PC. It seems to work without the while but I was printing analog values repeatedly and I didn't check if the first line printed out.
Logged


Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 639
Posts: 34725
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is this also needed for Micro since Micro uses the same 32U4? Thanks.
Yes.
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 76
Posts: 7305
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Mike. For some reason I was able to print to serial port without it. Is this needed if you want Micro to receive stuff from serial port, send stuff to serial port, or to make sure the first messages get sent or received? If I do serial methods without connecting to the usb, will the code throw exception and stop?
Logged


Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 639
Posts: 34725
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I think it is to give time for the USB to enumerate on the host machine. I could well see that this could have happened in the time that the bootloader is looking for an upload. It would depend on the speed of your computer, so maybe this is for older slower computers. But this is pure speculation on my part.

Quote
For some reason I was able to print to serial port without it.
Yes I think it is only critical for uploading a new sketch.
Logged

Pages: [1]   Go Up
Jump to: