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 ...