I want to use a ESP8266 (ESP12) to receive data from a counter at 9600 baud via SotwareSerial. But my program does not receive any data. I broke it down to the code i attach here. I tried it using different libraries (Arduino SoftwareSerial and also espsoftwareserial) i found. I connected and tested RX and TX in different combinations of the available pins 4/5/12/13/14. But no combination is receiving data at all. I only can send data - checked by oscilloscope. Running my test program attached i connected the RX and TX pin together so i should loop back the data from tx.
I hopefully find somebody in the community who can give me a helpful hint. Thank you in advance!
#include <SoftwareSerial.h>
SoftwareSerial mySerial1(14, 12, false, 256); // RX, TX
void setup() {
mySerial1.begin(9600); // Kommunikation mit Zähler
mySerial1.setTimeout(5000);
mySerial1.listen();
//delay(100);
//mySerial1.listen();
Serial.begin(9600);
delay(1000);
Serial.print(__DATE__);Serial.print(" ");Serial.println(__TIME__);
char ch;
while(1){
wdt_reset();
Serial.println("\nSoftware serial test started");
Serial.print("Data sent: ");
for (byte i = 32; i < 128; i++) { mySerial1.write(i);
Serial.print(char(i)); }
Serial.println();
mySerial1.println();
ESP.wdtFeed();
delay(100);
Serial.print("Data recv: ");
if(mySerial1.available()) {
while(mySerial1.available()){
ch = mySerial1.read();
Serial.print(ch);
}
Serial.println("_");
}
delay(400);
}
}
void loop() {}