user-1: 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());

}


user21624: Since you are  Arduino Uno, it has only one Serial. This Serial can be used to transmit data in USART mode to another Serial Device as well as see any Debug data in the Serial terminal.
However, both the functionality can not be used simultaneously. The Tx Rx pair of Arduino can be connected to one pair of other device i.e. either to the computer via the cable or to the Tx Rx of ESP8266.
But if you really need to plug in the Uno to the computer and send data to ESP8266 simultaneously, then you have to use SoftwareSerial library to convert any digital pin to Tx Rx pin, and connect them to ESP8266 for transmitting data. 

-1: <p>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.</p>

<p>My Arduino Code :</p>

<pre><code>void setup() {
    Serial.begin(9600);
}

void loop() {

    Serial.write("50");
    delay(1000);
}
</code></pre>

<p>My ESP8266 Code :</p>

<pre><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());

}
</code></pre>
 21624: <p>Since you are  Arduino Uno, it has only one <code>Serial</code>. This Serial can be used to transmit data in USART mode to another Serial Device as well as see any Debug data in the Serial terminal.</p>

<p>However, both the functionality can not be used simultaneously. The Tx Rx pair of Arduino can be connected to one pair of other device i.e. either to the computer via the cable or to the Tx Rx of ESP8266.</p>

<p>But if you really need to plug in the Uno to the computer and send data to ESP8266 simultaneously, then you have to use <a href="https://www.arduino.cc/en/Reference/SoftwareSerial" rel="noreferrer">SoftwareSerial</a> library to convert any digital pin to Tx Rx pin, and connect them to ESP8266 for transmitting data. </p>
