I try without success to receive datas from DataPort and transmit them to my computer via WifiPort, using ESP8266 wifi module. Each second, serial datas income on DataPort from another device.

Initialization as follow:

#include <SoftwareSerial.h>
#include "WiFiEsp.h"
SoftwareSerial DataPort(10, 11); // RX, TX
SoftwareSerial WifiPort(8, 9); // RX, TX

In setup:


In loop, i do:

WiFiEspClient client = server.available();
if (client) {
 //.... bla...bla...bla...

while (DataPort.available() > 0)
   char c = DataPort.read();
   str += c;
   if(c == '/')

WIFI PART runs fine if i isolate INCOMING SERIAL PART and INCOMING SERIAL PART runs fine without WIFI PART. So how can i receive datas on DataPort and transmit them when my computer ask them via the ESP8266 on WifiPort ?

  • please post the code in one block, not in chunks – jsotola Mar 19 '19 at 18:01
  • Yes Juraj, but how to switch on DataPort from WiFiPort or getting via wifi the serial incoming datas? What is the good code? – Teddol Mar 19 '19 at 18:21
  • DataPort only receives serial datas each second. Tx is not used. And I want to get this data with the ESP8266. – Teddol Mar 19 '19 at 18:46

The esp8266 AT firmware doesn't wait until you listen on the SoftwareSerial instance. If there is a connection to the server it sends +IPD and data. If the SoftwareSerial instance doesn't listen the information about client connection is lost.

You must listen to esp8266 all the time, so you can't use two SoftwareSerial instances.

You could use the RX pin of Uno to received data over hardware Serial, if you only receive on DataPort and only print to SerialMonitor.

  • I saw an example of instance of SoftwareSerial here: arduino.cc/en/Tutorial/TwoPortReceive. I think I could make it with Esp8266... – Teddol Mar 19 '19 at 19:08
  • it is what you have now. You must listen to esp8266 all the time, so you can't use two SoftwareSerial instances. – Juraj Mar 19 '19 at 19:45
  • Sorry, but I don't understand and see how can I solve my problem. – Teddol Mar 19 '19 at 20:18
  • wire the DataPort device to RX pin of Uno, remove SoftwareSerial for DataPort and read data from the device with Serial.read() – Juraj Mar 20 '19 at 5:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.