44 lines
1.3 KiB
C
44 lines
1.3 KiB
C
|
#ifndef HEADER_H
|
||
|
#define HEADER_H
|
||
|
#include <ESPAsyncWebServer.h>
|
||
|
#include <WiFiUdp.h>
|
||
|
#include <NTPClient.h>
|
||
|
#include <DHT.h>
|
||
|
#include <PubSubClient.h>
|
||
|
#include <Pangodream_18650_CL.h>
|
||
|
#include <secret.h>
|
||
|
|
||
|
#define TOPIC "test1"
|
||
|
#define MQTT_ADRESS "192.168.0.242"
|
||
|
#define MQTT_PORT 1883
|
||
|
#define DELAI 600000 //en ms
|
||
|
#define ESPNAME "esp32-bastien"
|
||
|
#define GRAPPE "grappe2"
|
||
|
#define NOMBRE_CAPTEUR 5
|
||
|
#define DHT22 22
|
||
|
#define TIME_TO_SLEEP 598
|
||
|
#define uS_TO_S_FACTOR 1000000
|
||
|
#define R2 100
|
||
|
#define R3 10
|
||
|
#define VOLTAGE_OUT(Vin) (((Vin)*R3) / (R2 + R3))
|
||
|
#define VOLTAGE_MAX 4200
|
||
|
#define VOLTAGE_MIN 3300
|
||
|
#define ADC_REFERENCE 1100
|
||
|
#define VOLTAGE_TO_ADC(in) ((ADC_REFERENCE * (in)) / 4096)
|
||
|
#define BATTERY_MAX_ADC VOLTAGE_TO_ADC(VOLTAGE_OUT(VOLTAGE_MAX))
|
||
|
#define BATTERY_MIN_ADC VOLTAGE_TO_ADC(VOLTAGE_OUT(VOLTAGE_MIN))
|
||
|
#define ADC_PIN 34
|
||
|
#define CONV_FACTOR 2.92
|
||
|
#define READS 20
|
||
|
|
||
|
void setupMQTT(const char *adresse, int port);
|
||
|
void setupWIFI(const char *wifiName, const char *password);
|
||
|
void reconnect(void);
|
||
|
void initCapteurs(DHT *capteurs, int L);
|
||
|
void lireCapteurs(DHT capteurs[], float temp[], float hum[], int L);
|
||
|
void ecrireMessage(char *txt, float *temp, float *hum, int L);
|
||
|
|
||
|
//timeClient.getEpochTime().toCharArray(date, 50); = convertir un string en char
|
||
|
|
||
|
#endif
|