From a2af5ef1495900d83ec623e0e899d09c55d1a95f Mon Sep 17 00:00:00 2001 From: Timo Volkmann Date: Sun, 28 Jun 2020 20:45:06 +0200 Subject: [PATCH] added PINs to header.h --- platformio.ini | 5 ++++- src/capacitiveSoilMoistureSensor.cpp | 4 +--- src/header.h | 22 +++++++++++++++++++++- src/main.cpp | 2 +- src/temperatureSensor.cpp | 6 +++--- 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/platformio.ini b/platformio.ini index 7d75caf..8c210a4 100644 --- a/platformio.ini +++ b/platformio.ini @@ -12,8 +12,11 @@ platform = espressif32 board = az-delivery-devkit-v4 framework = arduino +monitor_speed = 115200 lib_deps = 439 #ID of Lightsensor library BH1750 19 #DHT sensor library - 31 #Adafruit Unified Sensor \ No newline at end of file + 31 #Adafruit Unified Sensor + ; AutoConnect@^1.1.7 + ; PubSubClient@^2.8 \ No newline at end of file diff --git a/src/capacitiveSoilMoistureSensor.cpp b/src/capacitiveSoilMoistureSensor.cpp index 4f69fb6..b73b462 100644 --- a/src/capacitiveSoilMoistureSensor.cpp +++ b/src/capacitiveSoilMoistureSensor.cpp @@ -11,8 +11,6 @@ int readIndex = 0; // the index of the current reading int total = 0; // the running total int average = 0; // the average -int inputPin = 12; - void setupCapacitiveSoilMoistureSensor() { for (int thisReading = 0; thisReading < numReadings; thisReading++) { readings[thisReading] = 0; @@ -23,7 +21,7 @@ int loopCapacitiveSoilMoistureSensor() { // subtract the last reading: total = total - readings[readIndex]; // read from the sensor: - readings[readIndex] = analogRead(inputPin); + readings[readIndex] = analogRead(PIN_MS); // add the reading to the total: total = total + readings[readIndex]; // advance to the next position in the array: diff --git a/src/header.h b/src/header.h index 2d52083..1fddfd2 100644 --- a/src/header.h +++ b/src/header.h @@ -12,8 +12,28 @@ #include #include +// BH1750 LIGHT METER +// #define PIN_BH1750_SDA +// #define PIN_BH1750_SCL + +// DHT11 +#define PIN_DHT11 14 + +// MQ-135 +#define PIN_MQ135_A 12 +#define PIN_MQ135_D 13 + +// MOISTURE SENSOR +#define PIN_MS 27 + +// Ventil +#define PIN_VENTIL 26 + +// LED +#define PIN_LED_R 2 +#define PIN_LED_G 0 +#define PIN_LED_B 4 -extern int meineVariable; // moisture extern void setupCapacitiveSoilMoistureSensor(); diff --git a/src/main.cpp b/src/main.cpp index faf23ca..0990fda 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,7 +5,7 @@ #include void setup() { - Serial.begin(9600); + Serial.begin(115200); setupCapacitiveSoilMoistureSensor(); setupLightSensor(); setupTemperatureSensor(); diff --git a/src/temperatureSensor.cpp b/src/temperatureSensor.cpp index 53789b6..66e006e 100644 --- a/src/temperatureSensor.cpp +++ b/src/temperatureSensor.cpp @@ -1,14 +1,14 @@ #include -#define DHTPIN 4 +#define DHTPIN PIN_DHT11 -#define DHTTYPE DHT11 +#define DHTTYPE DHT11 DHT_Unified dht(DHTPIN, DHTTYPE); void setupTemperatureSensor() { - Serial.begin(9600); + // Serial.begin(9600); dht.begin(); Serial.println(F("DHT11 Unified Sensor Ready")); sensor_t sensor;