Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By nogard
#44238 Hey,
No doubt a noob question... but I'm trying to get my head around it - I need to read serial data sent from a device, so have plugged its TX into the RX of the ESP8266. In code, Serial obviously relates to the debug console via USB. How do I read code coming into the RX pin? Does Serial1 exist and relate too it? Do I have to use SoftwareSerial? If I use SoftwareSerial, what pin number does RX relate too?
Sorry, I'm just too used to Arduino hardware!
Thanks
User avatar
By nogard
#44275
willfly wrote:
Code: Select all// in setup()
Serial.begin(...);

// in loop()
if(Serial.available())  {
  int a = Serial.read();
}

I'm using Serial. for the Arduino IDE Serial Monitor window to display debugging info. I want to read data from the RX pin, and display it on the Arduino IDE serial monitor window. At present, I first connect to Wifi and display my IP address using Serial.println(WiFi.localIP()); (to know its connecting correctly) then want to display serial data coming in to the RX pin in the same IDE console window (for debugging purposes) then parse through and extract the data I need and send that data to an MQTT broker. Wifi and MQTT are working, I just can't work out how to read the RX serial info.
User avatar
By willfly
#44594 What is sending that serial data. Is it coming from Arduino IDE serial console (stuff that you type in)?

just print it back to console using this line:

Code: Select allSerial.print(Serial.read());