removed unjused code
This commit is contained in:
@@ -1,22 +1,15 @@
|
|||||||
#include <nodeCodeHeader.h>
|
#include <nodeCodeHeader.h>
|
||||||
#include "websockets.h"
|
#include "websockets.h"
|
||||||
// #include <WebSocketsClient.h>
|
|
||||||
|
|
||||||
|
|
||||||
// websockets webSocketClass;
|
|
||||||
nodeReadings esp32Node;
|
nodeReadings esp32Node;
|
||||||
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// put your setup code here, to run once:
|
// put your setup code here, to run once:
|
||||||
esp32Node.setup();
|
esp32Node.setup();
|
||||||
// webSocketClass.websocketSetup();
|
|
||||||
esp32Node.resetValues();
|
esp32Node.resetValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// put your main code here, to run repeatedly:
|
// put your main code here, to run repeatedly:
|
||||||
esp32Node.loop();
|
esp32Node.loop();
|
||||||
// webSocketClass.loop();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,18 +1,13 @@
|
|||||||
// #include <arduino.h>
|
|
||||||
#include "nodeCodeHeader.h"
|
#include "nodeCodeHeader.h"
|
||||||
// #include <DHT.h>
|
|
||||||
// #include <Adafruit_SH110X.h>
|
|
||||||
|
|
||||||
|
|
||||||
nodeReadings::nodeReadings() {
|
nodeReadings::nodeReadings() {
|
||||||
|
|
||||||
dht = new DHT(DHTPIN, DHTTYPE);
|
dht = new DHT(DHTPIN, DHTTYPE);
|
||||||
display = new Adafruit_SH1106G(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
|
display = new Adafruit_SH1106G(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
|
||||||
|
|
||||||
// webSocket = new WebSocketsClient();
|
|
||||||
webSocket = new websockets(); //nu naar eigen class
|
webSocket = new websockets(); //nu naar eigen class
|
||||||
sgp = new Adafruit_SGP30();
|
sgp = new Adafruit_SGP30();
|
||||||
|
|
||||||
|
interval = 5000;
|
||||||
resetValues();
|
resetValues();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -31,9 +26,6 @@ void nodeReadings::resetValues() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void nodeReadings::setup(){
|
void nodeReadings::setup(){
|
||||||
// DHT dht(DHTPIN, DHTTYPE);
|
|
||||||
|
|
||||||
|
|
||||||
// make serial connection at 115200 baud
|
// make serial connection at 115200 baud
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
|
||||||
@@ -50,9 +42,6 @@ void nodeReadings::setup(){
|
|||||||
|
|
||||||
webSocket->websocketSetup();
|
webSocket->websocketSetup();
|
||||||
|
|
||||||
// webSocketClass.websocketSetup();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nodeReadings::loop() {
|
void nodeReadings::loop() {
|
||||||
@@ -74,7 +63,6 @@ void nodeReadings::update(){
|
|||||||
// display sensordata on oled screen
|
// display sensordata on oled screen
|
||||||
displayData();
|
displayData();
|
||||||
|
|
||||||
// webSocket->sendTXT("{\"Temp\":\"" + String(temperature) + "\",\"Humi\":\"" + String(humidity) + "\",\"eCO2\":\"" + String(sgp->eCO2) + "\",\"TVOC\":\"" + String(sgp->TVOC) + "\"}");
|
|
||||||
webSocket->sendMyText("{\"node\": \"" + String(WiFi.macAddress()) + "\", \"Temp\":\"" + String(temperature) + "\",\"Humi\":\"" + String(humidity) + "\",\"eCO2\":\"" + String(sgp->eCO2) + "\",\"TVOC\":\"" + String(sgp->TVOC) + "\"}");
|
webSocket->sendMyText("{\"node\": \"" + String(WiFi.macAddress()) + "\", \"Temp\":\"" + String(temperature) + "\",\"Humi\":\"" + String(humidity) + "\",\"eCO2\":\"" + String(sgp->eCO2) + "\",\"TVOC\":\"" + String(sgp->TVOC) + "\"}");
|
||||||
|
|
||||||
sgp->getIAQBaseline(&eCO2_base, &TVOC_base);
|
sgp->getIAQBaseline(&eCO2_base, &TVOC_base);
|
||||||
@@ -92,13 +80,13 @@ void nodeReadings::displayData() {
|
|||||||
display->clearDisplay();
|
display->clearDisplay();
|
||||||
|
|
||||||
// display the data on the oled screen
|
// display the data on the oled screen
|
||||||
display->setTextSize(1);
|
display->setTextSize(2);
|
||||||
display->setTextColor(SH110X_WHITE);
|
display->setTextColor(SH110X_WHITE);
|
||||||
display->setCursor(0,0);
|
display->setCursor(0,0);
|
||||||
display->println("Temperature: " + String(temperature) + " C");
|
display->println("Temp: " + String(int(temperature)) + " C");
|
||||||
display->println("Humidity: " + String(humidity) + " %");
|
display->println("Humi: " + String(int(humidity)) + " %");
|
||||||
display->println("eCO2: " + String(sgp->eCO2) + " ppm");
|
display->println("eCO2: " + String(sgp->eCO2));// + " ppm");
|
||||||
display->println("TVOC: " + String(sgp->TVOC) + " ppb");
|
display->println("TVOC: " + String(sgp->TVOC));// + " ppb");
|
||||||
display->display();
|
display->display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,12 +2,8 @@
|
|||||||
#define nodeReading_h
|
#define nodeReading_h
|
||||||
|
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
|
|
||||||
// #include "Arduino.h"
|
|
||||||
#include <Adafruit_SH110X.h>
|
#include <Adafruit_SH110X.h>
|
||||||
// #include "headerFile.h"
|
|
||||||
#include <DHT.h>
|
#include <DHT.h>
|
||||||
// #include <WebSocketsClient.h>
|
|
||||||
#include <Adafruit_SGP30.h>
|
#include <Adafruit_SGP30.h>
|
||||||
#include "websockets.h"
|
#include "websockets.h"
|
||||||
|
|
||||||
@@ -24,8 +20,6 @@
|
|||||||
|
|
||||||
#define USE_SERIAL Serial
|
#define USE_SERIAL Serial
|
||||||
|
|
||||||
// WebSocketsClient webSocket;
|
|
||||||
|
|
||||||
class nodeReadings
|
class nodeReadings
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -41,7 +35,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
DHT *dht;
|
DHT *dht;
|
||||||
Adafruit_SH1106G *display;
|
Adafruit_SH1106G *display;
|
||||||
// WebSocketsClient *webSocket;
|
|
||||||
websockets *webSocket;
|
websockets *webSocket;
|
||||||
Adafruit_SGP30 *sgp;
|
Adafruit_SGP30 *sgp;
|
||||||
|
|
||||||
|
@@ -1,7 +1,3 @@
|
|||||||
// #include "arduino.h"
|
|
||||||
// #include <WebSocketsClient.h>
|
|
||||||
// #include <WiFiMulti.h>
|
|
||||||
// #include <WiFi.h>
|
|
||||||
#include "websockets.h"
|
#include "websockets.h"
|
||||||
|
|
||||||
websockets::websockets(){
|
websockets::websockets(){
|
||||||
@@ -35,9 +31,6 @@ void websockets::websocketSetup(){
|
|||||||
// server address, port and URL
|
// server address, port and URL
|
||||||
webSocket->begin("145.92.8.114", 80, "/ws");
|
webSocket->begin("145.92.8.114", 80, "/ws");
|
||||||
|
|
||||||
// event handler
|
|
||||||
// webSocket->onEvent(webSocketEvent);
|
|
||||||
|
|
||||||
// try ever 500 again if connection has failed
|
// try ever 500 again if connection has failed
|
||||||
webSocket->setReconnectInterval(500);
|
webSocket->setReconnectInterval(500);
|
||||||
}
|
}
|
||||||
@@ -59,8 +52,6 @@ void websockets::webSocketEvent(WStype_t type, uint8_t * payload, size_t length)
|
|||||||
webSocket->sendTXT("{\"message\": \"Connected\"}");
|
webSocket->sendTXT("{\"message\": \"Connected\"}");
|
||||||
break;
|
break;
|
||||||
case WStype_TEXT:
|
case WStype_TEXT:
|
||||||
// USE_SERIAL.printf("[WSc] get text: %s\n", payload);
|
|
||||||
|
|
||||||
// send message to server
|
// send message to server
|
||||||
// webSocket->sendTXT("message here");
|
// webSocket->sendTXT("message here");
|
||||||
break;
|
break;
|
||||||
|
@@ -7,10 +7,6 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
#define USE_SERIAL Serial
|
#define USE_SERIAL Serial
|
||||||
// WiFiMulti WiFiMulti;
|
|
||||||
|
|
||||||
// WebSocketsClient webSocket;
|
|
||||||
// WiFiMulti WiFiMulti;
|
|
||||||
|
|
||||||
class websockets {
|
class websockets {
|
||||||
public:
|
public:
|
||||||
|
Reference in New Issue
Block a user