Trying to read the responses from AT commands
I have a Nano connected to ESP8266-01 through pins 10/11, all the commands i am sending are of the format ser.println("AT+CWMODE=3\r\n"); and are working correctly, i know this as i am sending data wireless to my PC and capturing the sent data using a VB program, all this works great.
I am now trying to put some error trapping in and am struggling to read the responses from the AT commands, especially from AT+CIPSEND (Unvarnished Transmission Mode), this should return > to then send the data, when i read the response i am getting
M³aÃcåh�i}nµeú ÿI·D›:éBqTBÉ q1³
ë
ã
ŸE RãQGO—Rˆ
«
ìRÕumne 5T"o]tza÷l½:ˆ8=
v
ß
‘E²R×RýOÝS“
This almost looks like a BAUD issue but i cannot see why? the response is the same each time it loops, i think this suggests that its not just junk in the buffer?
I have tried BAUD 9600 and 115200, flushing the buffer before sending a command, putting in a delay after sending the command.
If i connect the Serial leads to RX/TX on the Nano and use the Arduino interface i can send commands directly to the ESP and get the correct response > so i know it all works but it seems to get lost in translation.
If you look at the response there is a > in there but there are also lots of other characters in there so it could just be coincidental?
This is the code that checks the response
ser.flush();
ser.println("AT+CIPSEND\r\n");
delay(500);
char response[200];
for(int i = 0 ; ser.available() > 0 && i<200 ; i++) {
response[i++] = ser.read();
}
//Serial.println(ser.read());
Serial.println(response);
Any help appreciated
Simon