hello
i have a distance measuring device connected to my esp8266. i have uploaded this code and can successfully communicate via rs232 through PUTTY windows terminal (can communicate in both directions between esp8266 and PUTTY, and also between PUTTY and my device). however, i do not read any information when i hook up my device to the same esp8266 rs232 port. the device data detail are 9600 baud, 8 bit, 1 start, parity:none, 1 stop, no flow control.
i can hook up my device to PUTTY windows terminal and read it fine. this is a sample of what it outputs at 4hz:
D 0000.032 0001.267:
my code, serial monitor, and device are all set to communicate at 9600 baudrate.
Where did i go wrong?
// ESP8266 SoftwareSerial test
#include <SoftwareSerial.h>
#define baudrate 9600//57600//38400//9600//115200
// pins Rx D5 (14) and Tx D6(12)
//SoftwareSerial mySerial(14, 12); // RX, TX
SoftwareSerial mySerial(14, 12); // RX, TX
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) { }
Serial.println();
Serial.println("ESP SoftwareSerial test!");
// set the data rate for the SoftwareSerial port
mySerial.begin(baudrate);//9600);
Serial.print("Serial test - Serial 1 at baudrate ");
Serial.println(baudrate);
//while(1) mySerial.write('X'); // send continuous test
}
void loop() {
if (mySerial.available())
Serial.write(mySerial.read());
while (Serial.available())
mySerial.write(Serial.read());
}