0

I am trying to get the response from server using AT commands. This is my program

#include <SoftwareSerial.h>

const byte rxPin = 2; // Wire this to Tx Pin of ESP8266
const byte txPin = 3; // Wire this to Rx Pin of ESP8266

// We'll use a software serial interface to connect to ESP8266
SoftwareSerial ESP8266 (rxPin, txPin);

void setup() {
  Serial.begin(115200);
  ESP8266.begin(115200); // Change this to the baudrate used by ESP8266
  delay(1000); // Let the module self-initialize
}

void loop() {
  Serial.println("Sending an AT command...");
  ESP8266.println("AT+CIPMUX=1");
  delay(3000);

  ESP8266.println("AT+CIPSTART=0,\"TCP\",\"192.168.50.1\",1234");
  delay(3000);

  while (ESP8266.available()){
     String res = ESP8266.readStringUntil('\t');
     Serial.println(res);
  }  


}

My server is just sending just one string as the output.

My console is getting this kind of output? Is there a way to clean this?

Sending an AT command...
AZi%PSՊj
C⸮j⸮L⸮AT+CIPSTART<0,"TCP","193.168.50.1",1234
0,CONNECT

OK
+IPD,0,1:10,CLOSDD

Sending an AT command...

I read thread and changed SoftwareSerial.h file. But still no luck.

Thanks in advance.

  • 1
    why do you not use a library? WiFiEsp for example? – Juraj Dec 22 '17 at 9:49
  • 2
    You can't use SoftwareSerial reliably at 115200 baud. – Majenko Dec 22 '17 at 10:08
  • @Majenko Yes, I tested even for 9600 – Sachith Dec 22 '17 at 10:15
  • @Juraj can you given me an example? I had been looking for this days. – Sachith Dec 22 '17 at 10:15
  • github.com/bportaluri/WiFiEsp – Juraj Dec 22 '17 at 10:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.