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