imranahmed
Advanced Member level 3
- Joined
- Dec 4, 2011
- Messages
- 817
- Helped
- 3
- Reputation
- 6
- Reaction score
- 3
- Trophy points
- 1,298
- Location
- Karachi,Pakistan
- Activity points
- 6,493
Please let me know about response of ESP8266MOD is not showing on Serial Monitor I set baud rate to 9600 but still not showing response but program is running well, data is transmitting to database successfully, I need responses of every AT command he sends.
Code:
#include <SoftwareSerial.h>
#define RX 2
#define TX 3
#define DEBUG true
String AP = "****************";
String PASS = "**************";
String sendData = "";
int sendVal;
String ROW1 = "", ROW2 = "";
SoftwareSerial espSerial(RX, TX);
void setup() {
Serial.begin(9600);
espSerial.begin(9600);
pinMode(8, INPUT_PULLUP);
espData("AT+RST", 1000, DEBUG); //Reset the ESP8266 module
espData("AT+CWMODE=1", 1000, DEBUG); //Set the ESP mode as station mode
espData("AT+CWJAP=\"" + AP + "\",\"" + PASS + "\"", 1000, DEBUG); //Connect to WiFi network
delay(2000);
}
void loop() {
sendData = "GET http://"HERE IP ADDRESS"/fileapi.php?ROW1=123&ROW2=878";
"&ROW1=" + ROW1 +
"&ROW1=" + ROW2;
espData("AT+CIPMUX=1", 1000, DEBUG);
espData("AT+CIPSTART=0,\"TCP\",\"HERE IP ADDRESS\",80", 1000, DEBUG);
espData("AT+CIPSEND=0," + String(sendData.length() + 4), 1000, DEBUG);
espSerial.find(">");
espSerial.println(sendData);
Serial.print("Value to be sent: ");
Serial.println(sendData);
espData("AT+CIPCLOSE=0", 1000, DEBUG);
delay(2000);
}
String espData(String command, const int timeout, boolean debug)
{
Serial.print("AT Command ==> ");
Serial.print(command);
Serial.println(" ");
String response = "";
espSerial.println(command);
long time = millis();
while ( (time + timeout) > millis())
{
while (espSerial.available())
{
char c = espSerial.read();
response += c;
}
}
if (debug)
{
Serial.print(response);
}
return response;
}