-->
Page 1 of 1

Check that your ESP8266 is working

PostPosted: Fri Aug 19, 2022 6:19 am
by AcmeUK
Here is a simple sketch to see if your ESP8266 and associated setup is working. (IDE, cable, correct board type selected.)
Use the IDE serial terminal to interact with the sketch.

String readString;

void setup() {
Serial.begin(74880); // 74880 Baud same as ESP8266 boot messages, so that boot messages are readable!

Serial.println("STRING echo"); // so I can see that the sketch is loaded
}

void loop() {
readString=""; // set the string to an empty string
while (Serial.available()) {
delay(3); //delay to allow buffer to fill
if (Serial.available() >0) {
char c = Serial.read(); //gets one byte from serial buffer
readString += c; //makes the string readString
}
}

if (readString.length() >0) {
Serial.println(readString); //see what was received
}
}

Re: Check that your ESP8266 is working

PostPosted: Sat Aug 20, 2022 3:19 am
by rooppoorali
Usually, I print a message in the serial monitor to check. Isn't that sufficient?

Re: Check that your ESP8266 is working

PostPosted: Sun Aug 21, 2022 5:18 am
by AcmeUK
@rooppoorali
I agree. But this also gives a method for capturing keyboard input.

Re: Check that your ESP8266 is working

PostPosted: Sun Aug 21, 2022 11:45 pm
by rooppoorali
Thanks a lot.