Skip to content

"delay(10)" after Serial.begin in examples #3496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tttapa opened this issue Aug 4, 2017 · 6 comments
Closed

"delay(10)" after Serial.begin in examples #3496

tttapa opened this issue Aug 4, 2017 · 6 comments
Labels
component: examples good first issue If you want to help, this is is a good place to start level: easy type: code cleanup

Comments

@tttapa
Copy link

tttapa commented Aug 4, 2017

Many examples of the ESP8266WiFi library have this in the setup:

Serial.begin(115200);
delay(10);

What is the purpose of the delay? At first glance, everything seems to work perfectly fine without it.
GitHub search for "delay(10)"

Thanks,
Pieter

@5chufti
Copy link
Contributor

5chufti commented Aug 4, 2017

this is maybe leftover from Arduino Leonardo examples

void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}

// prints title with ending line break
Serial.println("ASCII Table ~ Character Map");
}

@tablatronix
Copy link
Contributor

I usually use a 1 second delay so my serial program can reconnect to the serial port or else i miss the boot sequence and first print

@5chufti
Copy link
Contributor

5chufti commented Nov 5, 2017

a delay in the setup() won't give you time to see the boot message ...

@tablatronix
Copy link
Contributor

sorry I meant my setup boot sequence, not esp

@igrr igrr added component: examples level: easy type: code cleanup good first issue If you want to help, this is is a good place to start labels Jan 2, 2018
@bryankettle
Copy link

It's just left over code. It is not really needed nowadays.
It is used to give time for the esp to initialize the serial

@earlephilhower
Copy link
Collaborator

Fixed in #5290

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: examples good first issue If you want to help, this is is a good place to start level: easy type: code cleanup
Projects
None yet
Development

No branches or pull requests

6 participants