Skip to main content

Serial Communication between ESP8266 and Arduino Uno

I want to send data from arduino to ESP8266. I have done all the RX and TX connections. The problem is that data is not sent every second, it stops after a single byte. When I remove the arduino cable then data is read.

My Arduino Code :

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

void loop() {

    Serial.write("50");
    delay(1000);
}

My ESP8266 Code :

void setup() {
 
Serial.begin(9600);
 
  // connect to wifi.
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  
  while (WiFi.status() != WL_CONNECTED) {
   
    delay(500);
  }
  Serial.println("Connected !");
  
}   

void loop() {     

 Serial.print(Serial.readString());
 
}
Gunjan Raval