From 0388f1bad014c0cb1f78d2b5a276b4945acca4b7 Mon Sep 17 00:00:00 2001 From: Luis Rodil-Fernandez Date: Tue, 15 Feb 2022 00:58:05 +0100 Subject: [PATCH] call the atomizer calibration process now and defined the pin where the LDR sensor for calibration is placed --- src/config.h | 1 + src/main.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/config.h b/src/config.h index 97627ff..4d3d7a4 100644 --- a/src/config.h +++ b/src/config.h @@ -3,6 +3,7 @@ #define PIN_DHT 16 #define PIN_ATOMIZER 4 +#define PIN_ATOMIZER_LDR 33 // mqtt://interact:c9FjEDUnRgDTalBR@interact.cloud.shiftr.io #define MQTT_BROKER "interact.cloud.shiftr.io" diff --git a/src/main.cpp b/src/main.cpp index 8865993..cc67a71 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -14,7 +14,7 @@ #include "mqtt.h" DHT dht(PIN_DHT, DHT11); -Atomizer fog(PIN_ATOMIZER); +Atomizer fog(PIN_ATOMIZER, PIN_ATOMIZER_LDR); typedef struct dhtReading { float humidity, // in % @@ -32,8 +32,6 @@ void setup() { Serial.begin(115200); LOG_INIT(); - pinMode(PIN_ATOMIZER, OUTPUT); - duty.setFrequency(0.05); duty.setAmplitude(0.5); duty.setPhase(0); @@ -51,6 +49,8 @@ void setup() { Serial.println("Brace! Brace! trying to continue without wifi..."); } + fog.calibrate(); + mqtt_init(); Serial.println("Initializing DHT sensor...");