I'm successfully running AT commands via the Serial Monitor. But now I'm issuing AT commands via Arduino code and facing problems getting the correct response.
Goal: After issuing AT commands programatically, knowing whether these run successfully or not.
Microcontroller: Arduino Uno
#include<string.h>
#include<SoftwareSerial.h>
#define OK "OK"
#define SERVER_PORT 1234
#define RX_PIN 2
#define TX_PIN 3
SoftwareSerial ESP(RX_PIN, TX_PIN);
void setup() {
Serial.begin(115200);
Serial.println("First serial");
while(!Serial);
ESP.begin(115200);
Serial.println("Second serial");
while(!ESP);
//Enabling multiple connections
ESP.println("AT+CIPMUX=1\r\n");
while (!ESP.available());
String muxResponse = ESP.readString();
Serial.print("muxR:");
Serial.println(muxResponse);
}
void loop() {
if (ESP.available()) {
String val = ESP.readString();
Serial.println(val);
}
}
After running the above code I get the response in the Serial Monitor like:
muxR:AT+CIPMUX=1
busy p../
OK
I'm getting special characters too.