I’m trying to use the software serial library in my arduino Uno to read packets from a ESP8266. I set a constant word packet to test the comms and see if it is working, but it shows a very erratic behavior. Every time a packet is read, the values are different. My arduino code only reads the software serial port and prints it back to the monitor. Code:
#include <SoftwareSerial.h>
SoftwareSerial esp8266(2,3); //TX, RX
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
esp8266.begin(115200);
}
String old_msg="";
String data;
void loop() {
//Check to see if anything is available in the serial receive buffer
while (Serial.available()) {
Serial.write(Serial.read());
}
Also i am using an ESP8266 wifi module thing that is powered from the arduinos 5V
So i have changed the code to this: #include <SoftwareSerial.h>
SoftwareSerial esp8266(2,3); //TX, RX
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
esp8266.begin(115200);
}
String old_msg="";
String data;
void loop() {
//Check to see if anything is available in the serial receive buffer
while (esp8266.available()) {
Serial.write(esp8266.read());
}
}
And i have connected esp8266 RX to pin 3 and TX to pin 2 and it still shows messed up data from the char it is reciving from the esp.