Professional Documents
Culture Documents
ESP8266
ESP8266
ESP8266
h>
SoftwareSerial esp8266(2,3); // make RX Arduino line is pin 5, make TX Arduino line is pin 6.
void setup()
pinMode(LED, OUTPUT);
Serial.begin(9600);
sendData("AT+CWJAP=\"yourssid\",\"pass\"\r\n", 6000, DEBUG); //Put Your SSID and password if activate as Station mode else
comment down the line
sendData("AT+CIFSR\r\n",2000,DEBUG); // get ip address
void loop()
if(esp8266.find("+IPD,"))
// the ASCII decimal value and 0 (the first decimal number) starts at 48
String msg;
esp8266.find("?");
delay(100);
// HTML START
if (command1 == "T"){
if (itsONled[1] == 1)
digitalWrite(LED, LOW);
itsONled[1] = 0;
else
digitalWrite(LED, HIGH);
itsONled[1] = 1;
cipSend += connectionId;
cipSend += ",";
cipSend +=webpage.length();
cipSend +="\r\n";
sendData(cipSend,500,DEBUG);
sendData(webpage,500,DEBUG);
closeCommand+="\r\n";
sendData(closeCommand,500,DEBUG);
{
esp8266.print(command); // send the read character to the esp8266
while(esp8266.available())
// The esp has data so display its output to the serial window
Serial.write(esp8266.read());
}
//Make sure to subscribe Technomekanics:)
int setupESP8266(void) {
if (!Serial.find("OK")) return 1;
// Connect to 123D Circuits Simulator Wifi
if (!Serial.find("OK")) return 2;
if (!Serial.find("OK")) return 3;
return 0;
void anydata(void) {
String httpPacket = "GET " + uri + String(temp) + " HTTP/1.1\r\nHost: " + host + "\r\n\r\n";
Serial.print("AT+CIPSEND=");
Serial.println(length);
delay(10); // Wait a little for the ESP to respond if (!Serial.find(">")) return -1;
Serial.print(httpPacket);
void setup() {
setupESP8266();
void loop() {
anydata();
delay(10000);