Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By AcmeUK
#95103 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
}
}