adds comments
This commit is contained in:
@@ -148,6 +148,8 @@ bool checkForError(){
|
|||||||
void update(){
|
void update(){
|
||||||
// display sensordata on oled screen
|
// display sensordata on oled screen
|
||||||
displayData();
|
displayData();
|
||||||
|
|
||||||
|
// send data to websocket server
|
||||||
webSocket.sendTXT("Temp: " + String(temperature));
|
webSocket.sendTXT("Temp: " + String(temperature));
|
||||||
webSocket.sendTXT("Humi: " + String(humidity));
|
webSocket.sendTXT("Humi: " + String(humidity));
|
||||||
webSocket.sendTXT("eCO2: " + String(sgp.eCO2));
|
webSocket.sendTXT("eCO2: " + String(sgp.eCO2));
|
||||||
@@ -159,6 +161,7 @@ void update(){
|
|||||||
temperature = float(dht.readTemperature());
|
temperature = float(dht.readTemperature());
|
||||||
humidity = float(dht.readHumidity());
|
humidity = float(dht.readHumidity());
|
||||||
|
|
||||||
|
// check if any errors occured when reading sensors
|
||||||
checkForError();
|
checkForError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,12 +180,14 @@ void displayData() {
|
|||||||
+ "Humi: " + int(humidity) + "%" + '\n'
|
+ "Humi: " + int(humidity) + "%" + '\n'
|
||||||
+ "eCO2: " + int(sgp.eCO2) + '\n'
|
+ "eCO2: " + int(sgp.eCO2) + '\n'
|
||||||
+ "TVOC: " + int(sgp.TVOC));
|
+ "TVOC: " + int(sgp.TVOC));
|
||||||
|
|
||||||
|
// display the screen
|
||||||
display.display();
|
display.display();
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup function
|
// setup function
|
||||||
void setup() {
|
void setup() {
|
||||||
|
// make serial connection at 115200 baud
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
|
||||||
// tell display what settings to use
|
// tell display what settings to use
|
||||||
@@ -196,7 +201,10 @@ void setup() {
|
|||||||
pinMode(MICPIN, INPUT);
|
pinMode(MICPIN, INPUT);
|
||||||
pinMode(DHTPIN, INPUT);
|
pinMode(DHTPIN, INPUT);
|
||||||
|
|
||||||
|
// setup websocket connection
|
||||||
websocketSetup();
|
websocketSetup();
|
||||||
|
|
||||||
|
// reset values
|
||||||
resetValues();
|
resetValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user