added PINs to header.h
This commit is contained in:
parent
82dfd49210
commit
a2af5ef149
@ -12,8 +12,11 @@
|
|||||||
platform = espressif32
|
platform = espressif32
|
||||||
board = az-delivery-devkit-v4
|
board = az-delivery-devkit-v4
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
monitor_speed = 115200
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
439 #ID of Lightsensor library BH1750
|
439 #ID of Lightsensor library BH1750
|
||||||
19 #DHT sensor library
|
19 #DHT sensor library
|
||||||
31 #Adafruit Unified Sensor
|
31 #Adafruit Unified Sensor
|
||||||
|
; AutoConnect@^1.1.7
|
||||||
|
; PubSubClient@^2.8
|
||||||
@ -11,8 +11,6 @@ int readIndex = 0; // the index of the current reading
|
|||||||
int total = 0; // the running total
|
int total = 0; // the running total
|
||||||
int average = 0; // the average
|
int average = 0; // the average
|
||||||
|
|
||||||
int inputPin = 12;
|
|
||||||
|
|
||||||
void setupCapacitiveSoilMoistureSensor() {
|
void setupCapacitiveSoilMoistureSensor() {
|
||||||
for (int thisReading = 0; thisReading < numReadings; thisReading++) {
|
for (int thisReading = 0; thisReading < numReadings; thisReading++) {
|
||||||
readings[thisReading] = 0;
|
readings[thisReading] = 0;
|
||||||
@ -23,7 +21,7 @@ int loopCapacitiveSoilMoistureSensor() {
|
|||||||
// subtract the last reading:
|
// subtract the last reading:
|
||||||
total = total - readings[readIndex];
|
total = total - readings[readIndex];
|
||||||
// read from the sensor:
|
// read from the sensor:
|
||||||
readings[readIndex] = analogRead(inputPin);
|
readings[readIndex] = analogRead(PIN_MS);
|
||||||
// add the reading to the total:
|
// add the reading to the total:
|
||||||
total = total + readings[readIndex];
|
total = total + readings[readIndex];
|
||||||
// advance to the next position in the array:
|
// advance to the next position in the array:
|
||||||
|
|||||||
22
src/header.h
22
src/header.h
@ -12,8 +12,28 @@
|
|||||||
#include <DHT.h>
|
#include <DHT.h>
|
||||||
#include <DHT_U.h>
|
#include <DHT_U.h>
|
||||||
|
|
||||||
|
// 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
|
// moisture
|
||||||
extern void setupCapacitiveSoilMoistureSensor();
|
extern void setupCapacitiveSoilMoistureSensor();
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
#include <header.h>
|
#include <header.h>
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(115200);
|
||||||
setupCapacitiveSoilMoistureSensor();
|
setupCapacitiveSoilMoistureSensor();
|
||||||
setupLightSensor();
|
setupLightSensor();
|
||||||
setupTemperatureSensor();
|
setupTemperatureSensor();
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
#include <header.h>
|
#include <header.h>
|
||||||
|
|
||||||
#define DHTPIN 4
|
#define DHTPIN PIN_DHT11
|
||||||
|
|
||||||
#define DHTTYPE DHT11
|
#define DHTTYPE DHT11
|
||||||
|
|
||||||
|
|
||||||
DHT_Unified dht(DHTPIN, DHTTYPE);
|
DHT_Unified dht(DHTPIN, DHTTYPE);
|
||||||
|
|
||||||
void setupTemperatureSensor() {
|
void setupTemperatureSensor() {
|
||||||
Serial.begin(9600);
|
// Serial.begin(9600);
|
||||||
dht.begin();
|
dht.begin();
|
||||||
Serial.println(F("DHT11 Unified Sensor Ready"));
|
Serial.println(F("DHT11 Unified Sensor Ready"));
|
||||||
sensor_t sensor;
|
sensor_t sensor;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user