Delay for Serial.print

Hello every body,

I'll try a little try with my MKR1000:

void setup(){
   Serial.begin(115200);
   Serial.println("test");
}
void loop(){
}

Wel, output on monitor = nothing......
The way to obtain a serial output, insert a delay of more than 1000 milli second.

thus with the code

void setup(){
     Serial.begin(115200);
     delay(1000);
     Serial.println("TEST"); .....

So I have a output on my monitor....
For my project in not really a problem, because before to use the serial monitor, I call so
many function that the delay is enough, but....

Strange no ????

michel

you might want to do

void setup(){
  Serial.begin(115200);
  while (!Serial) yield();
  Serial.println("test");
}

void loop(){}

The MKR1000 has a native USB interface. That means after Serial.begin() you have to wait until the USB connection to the serial Monitor is established before you can send data. That is what

in @J-M-L 's post does.

Thank you, MicroBanner

it's clear

i'll try to remember that in the future of my MKR use :slight_smile:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.