OOP made in arduino 👍
This commit is contained in:
@@ -1,22 +1,60 @@
|
||||
#ifndef nodeReading_h
|
||||
#define nodeReading_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "headerFile.h"
|
||||
#include <Wire.h>
|
||||
|
||||
// #include "Arduino.h"
|
||||
#include <Adafruit_SH110X.h>
|
||||
// #include "headerFile.h"
|
||||
#include <DHT.h>
|
||||
#include <WebSocketsClient.h>
|
||||
#include <Adafruit_SGP30.h>
|
||||
|
||||
class nodeReadings {
|
||||
// define pins on esp32
|
||||
#define MICPIN 6
|
||||
#define DHTPIN 7
|
||||
#define SCL 9
|
||||
#define SDA 8
|
||||
#define DHTTYPE DHT11
|
||||
#define SCREEN_WIDTH 128
|
||||
#define SCREEN_HEIGHT 64
|
||||
#define i2c_adress 0x3c
|
||||
#define OLED_RESET -1 // QT-PY / XIAO
|
||||
|
||||
public:
|
||||
nodeReadings();
|
||||
void setup();
|
||||
void loop();
|
||||
void resetValues();
|
||||
void update();
|
||||
void checkForError();
|
||||
void displayData();
|
||||
#define USE_SERIAL Serial
|
||||
|
||||
private:
|
||||
// WebSocketsClient webSocket;
|
||||
|
||||
class nodeReadings
|
||||
{
|
||||
|
||||
public:
|
||||
nodeReadings();
|
||||
void setup();
|
||||
void loop();
|
||||
void resetValues();
|
||||
void update();
|
||||
void checkForError();
|
||||
void displayData();
|
||||
|
||||
private:
|
||||
DHT *dht;
|
||||
Adafruit_SH1106G *display;
|
||||
WebSocketsClient *webSocket;
|
||||
Adafruit_SGP30 *sgp;
|
||||
|
||||
uint16_t TVOC_base, eCO2_base;
|
||||
uint16_t counter;
|
||||
uint16_t eCO2;
|
||||
uint16_t TVOC;
|
||||
uint16_t interval;
|
||||
float temperature;
|
||||
float humidity;
|
||||
unsigned long currentMillis;
|
||||
unsigned long lastMillis;
|
||||
bool errorSGP30;
|
||||
bool errorDHT11;
|
||||
bool noise;
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user