Controlling your home from a dashboard
In the first project of this chapter, we are going to learn how to control all the modules we assembled before from a cloud dashboard, using the aREST framework we already used in this book.
First, let's configure all the modules. We are going to start with the LED dimmer module, which is the easiest to configure. Here is the complete code for this module:
// Import required libraries #include "ESP8266WiFi.h" #include <PubSubClient.h> #include <aREST.h> // Clients WiFiClient espClient; PubSubClient client(espClient); // Unique ID to identify the device for cloud.arest.io char* device_id = "6g37g4"; // Create aREST instance aREST rest = aREST(client); // WiFi parameters const char* ssid = "wifi-name"; const char* password = "wifi-pass"; // The port to listen for incoming TCP connections #define LISTEN_PORT 80 // Create an instance of the server WiFiServer server(LISTEN_PORT); void...