ESP8266 Wifi Module

 RM 22.00
ESP-01 ESP8266 Wifi Module

Package included : ESP-01 ESP8266 Wifi Module x 1 Unit

ESP8266 Firmware (9600 baud rate) : Firmware.zip

Pin Hookup :

What The code do :
1. Arduino will send "AT" command to ESP8266.
2. If arduino receive back "OK" from ESP8266, LED on pin D13 will blink.

Test Code :


int esp_status = 0; int toggle = 0; void setup() { Serial.begin(115200); pinMode(13, OUTPUT); digitalWrite(13, toggle); } void loop() { delay(1000); esp_status = sendATcommand("AT", "OK", 2000); // checks if the module is started if (esp_status == 1) { toggle = ~toggle; digitalWrite(13, toggle); } esp_status = 0; } int8_t sendATcommand(char* ATcommand, char* expected_answer, unsigned int timeout) { uint8_t x=0, answer=0; char response[100]; unsigned long previous; memset(response, '\0', 100); delay(100); while( Serial.available() > 0) Serial.read(); // Clean the input buffer Serial.println(ATcommand); // Send the AT command x = 0; previous = millis(); // this loop waits for the answer do { // if there are data in the UART input buffer, reads it and checks for the asnwer if(Serial.available() != 0) { response[x] = Serial.read(); x++; // check if the desired answer is in the response of the module if (strstr(response, expected_answer) != NULL) { answer = 1; } } // Waits for the asnwer with time out }while((answer == 0) && ((millis() - previous) < timeout)); return answer; }