This is my code:
void setup() {
Serial.begin(115200);
while (!Serial);
delay(500);
void loop(){
Serial.println("HELLOOO");
}
It works without any problems when put the Serial.println
inside the loop() but I cant print anything when print inside the setup() for example this code
void setup() {
Serial.begin(115200);
while (!Serial);
delay(500);
Serial.println("Setup");
}
void loop(){
}
Why Serial.println does not work inside setup()
Hi,
It is hard to see the problem without the full code.
Can you please upload your full code?
Also, why do you need this line?
while (!Serial);
Thanks,
Matej
ua6em
February 22, 2023, 12:15pm
3
Your code can't even compile,
maybe so?
void setup() {
Serial.begin(115200);
while (!Serial);
delay(500);
Serial.println("START");
}
void loop(){
Serial.println("HELLOOO");
}
It can, I just tried on arduino ide 2.0
You forgot to add "}" at the end of void setup()
I solved the problem by change.
delay(500) to delay(1000)
system
Closed
August 21, 2023, 7:01pm
7
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.