Skip to Content
Internet of Things with ESP8266
book

Internet of Things with ESP8266

by Marco Schwartz
July 2016
Intermediate to advanced
226 pages
4h 6m
English
Packt Publishing
Content preview from Internet of Things with ESP8266

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

ESP8266 Internet of Things Cookbook

ESP8266 Internet of Things Cookbook

Marco Schwartz
ESP8266 Robotics Projects

ESP8266 Robotics Projects

Pradeeka Seneviratne

Publisher Resources

ISBN: 9781786468024Supplemental Content