Connecting your module to your Wi-Fi network

Now, we are going to check whether the ESP8266 and the Arduino IDE are working correctly, and connect your chip to your local Wi-Fi network.

To do so, let's perform the following steps:

  1. First, we need to write the code and then upload it to the board. The code is simple; we just want to connect to the local Wi-Fi network and print the IP address of the board. This is the code to connect to the network:
    // Import required libraries #include <ESP8266WiFi.h> // WiFi parameters constchar* ssid = "your_wifi_name"; constchar* password = "your_wifi_password"; void setup(void) { // Start Serial Serial.begin(115200); // Connect to WiFi WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500);
Serial.print("."); ...

Get Internet of Things with ESP8266 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.