O'Reilly logo

ESP8266 Home Automation Projects by Catalin Batrinu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

ESP8266 code

Since the sketch has also some extra classes for the WebSocket connection, here the essential part of the .ino file will just be shown. For the entire project, please see the following GitHub address:

https://github.com/bcatalin/esp8266-book/tree/master/Chapter7.

Necessary included files are:

#include "Wire.h" 
#include <Adafruit_Sensor.h> 
#include <Adafruit_ADXL345_U.h> 
#include <FS.h>                    
#include <ESP8266WiFi.h>          
#include "SocketIOClient.h" 
#include <DNSServer.h> 
#include <ESP8266WebServer.h> 
#include <WiFiManager.h>           
#include <ArduinoJson.h>           
#include <Wire.h> 
#include <ESP8266HTTPClient.h> 
#include <ESP8266httpUpdate.h> 
#include <SPI.h> 

Instantiate an accel object and create a unique identification as a parameter for the class ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required