So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By ludkokanta
#67450 I managed to set up a webserver (websockets) on the ESP8266.

I'd like to read a string from a hardware serial link from an Arduino UNO reading sensors and switches.

It is an "all in one" board with dip switches, ESP, UNO and a CH340. Pins 0 and 1 are designated for rtxt and are free...

My UNO sends a String at 9600 baud. How do I pick it up?
....setup
Serial1.begin(9600);
......loop
if ( Serial1.available() ) { string1 = Serial1.readString() ; }
...

It didn't work. Is it the other Serial? Do I change the Baud on both of them to 115200 on which the ESP comes out of the box?
User avatar
By urbanze
#67500 i can't teste this code now, but i think this work.. test and tell me!

String req;

void setup()
{
Serial.begin(115200);
}

void loop()
{
if (Serial.available() > 0)
{
req = "";
while (Serial.available() > 0)
{
char z = Serial.read();
req += z;
}

if (req == "ON")
{
digitalWrite(13, 1);
}
}
}