Configuring the ESP8266 board

It's now time to configure the ESP8266 Wi-Fi chip so it can accept commands coming from the cloud. This is something we already saw earlier, but it's always good to remember the basics, as we'll make a more complicated sketch later in this chapter:

  1. We first need to include the required libraries:
    #include <ESP8266WiFi.h>
    #include <PubSubClient.h>
    #include <aREST.h>
  2. Then, we declare a Wi-Fi client and PubSub (MQTT) client:
    WiFiClient espClient;
    PubSubClient client(espClient);
  3. After that, we create an instance of the aREST library:
    aREST rest = aREST(client);
  4. You also need to enter your Wi-Fi name and password into the sketch:
    const char* ssid = "wifi-ssid";
    const char* password = "wifi-pass";
  5. You can also give a name to your ...

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.