Print Issue

Status
Not open for further replies.

jdpeiffer

New member
Hello all,

Using teensy 4.0, arduino 1.8.13, and teensyloader 1.53, it appears
Code:
Serial.println()
does not print in the setup or the first loop iteration. Any thoughts?

Code:
int i=0;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial.println("END SETUP");
}

void loop() {
  // put your main code here, to run repeatedly:
  
  Serial.println("Begin");
  Serial.println(i);
  delay(1000);
  Serial.println("End");
  i++;
  
}

Gives output:

Code:
End
Begin
1
End
Begin
2
End
Begin
3
End
Begin
4
...

Thanks,
JD
 
Last edited:
Add this in setup:

Code:
  while (!Serial) ; // wait for Arduino Serial Monitor to open

or this if you want it to run after a few seconds even if the PC doesn't respond

Code:
  while (!Serial && millis() < 4000) ; // wait up to 4 seconds for Arduino Serial Monitor to open
 
Status
Not open for further replies.
Back
Top