#include <SoftwareSerial.h>
SoftwareSerial esp8266(1,0);
void setup()
{
esp8266.begin(115200);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.println(sendData("AT+RST",2000)); // reset module
displayz(1000);
display.println(sendData("AT+CWMODE=2",1000)); // configure as access point
displayz(1000);
display.println(sendData("AT+CIFSR",1000)); // get ip address
displayz(1000);
display.println(sendData("AT+CIPMUX=1",1000)); // configure for multiple connections
displayz(1000);
display.println(sendData("AT+CIPSERVER=1,80",1000)); // turn on server on port 80
displayz(1000);
}
void loop()
{ }
void displayz(int timeout) {
display.display();
delay(timeout);
display.clearDisplay();
display.setCursor(0,0);
}
String sendData(String command, const int timeout)
{
String response = "";
esp8266.print(command); // send the read character to the esp8266
long int time = millis();
while( (time+timeout) > millis())
{
while(esp8266.available())
{
char c = esp8266.read(); // read the next character.
response+=c;
}
}
return response;
}
Any help appreciated!!
esp8266.print(
with this:
esp8266.println(
Or include "\r\n" at the end of all of your commands.