Libs download

This commit is contained in:
2023-08-12 17:06:41 +03:00
parent 1aa51ad242
commit 8f8954f700
5 changed files with 45 additions and 30 deletions

View File

@@ -21,3 +21,4 @@ lib_deps =
ayushsharma82/WebSerial @ ^1.3.0
ottowinter/ESPAsyncWebServer-esphome @ ^3.0.0
lewapek/Nova Fitness Sds dust sensors library @ ^1.5.1
ottowinter/AsyncMqttClient-esphome @ ^0.8.6

View File

@@ -25,5 +25,8 @@ lib_deps =
crankyoldgit/IRremoteESP8266 @ ^2.8.2
ayushsharma82/WebSerial @ ^1.3.0
ottowinter/ESPAsyncWebServer-esphome @ ^3.0.0
ottowinter/AsyncMqttClient-esphome @ ^0.8.6
adafruit/Adafruit BME280 Library @ ^2.2.2
wifwaf/MH-Z19 @ ^1.5.4
;joaolopesf/RemoteDebug @ 3.0.5

View File

@@ -7,6 +7,9 @@
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
;enjoyneering/AHT10@^1.1.0
;ottowinter/AsyncMqttClient-esphome @ ^0.8.6
;adafruit/Adafruit AHTX0 @ ^2.0
[env:d1_mini]
platform = espressif8266
@@ -17,11 +20,10 @@ upload_port = 192.168.1.136
lib_deps =
;enjoyneering/AHT10@^1.1.0
;ottowinter/AsyncMqttClient-esphome @ ^0.8.6
knolleary/PubSubClient @ ^2.8
ottowinter/ESPAsyncWebServer-esphome @ ^2.1.0
ayushsharma82/AsyncElegantOTA @ ^2.2.6
ayushsharma82/WebSerial @ ^1.3.0
jwrw/ESP_EEPROM @ ^2.0.0
adafruit/Adafruit AHTX0 @ ^2.0.3
beegee-tokyo/DHT sensor library for ESPx @ ^1.19

View File

@@ -1,5 +1,6 @@
#include <Arduino.h>
#include <Adafruit_AHTX0.h>
//#include <Adafruit_AHTX0.h>
#include "DHTesp.h"
#include <ArduinoOTA.h>
#include <Ticker.h>
#include <ESP8266WiFi.h>
@@ -24,8 +25,11 @@
#define LAMP_OUT (D5)
Adafruit_AHTX0 aht;
sensors_event_t humidity, temp;
//Adafruit_AHTX0 aht;
DHTesp dht;
TempAndHumidity sTaH;
//sensors_event_t humidity, temp;
float temp_out, hum_out;
WiFiClient espClient;
@@ -94,16 +98,18 @@ void setup() {
pinMode(LED_MQ, OUTPUT);
pinMode(LED_WRK, OUTPUT);
pinMode(LAMP_OUT, OUTPUT);
if (! aht.begin()) {
Serial.println("Could not find AHT? Check wiring");
aht_pesent = false;
} else{
if(aht.getEvent(&humidity, &temp)){
temp_out = temp.temperature;
hum_out = humidity.relative_humidity;
}
aht_pesent = true;
}
dht.setup(D1, DHTesp::DHT22);
delay(dht.getMinimumSamplingPeriod());
// if (! aht.begin()) {
// Serial.println("Could not find AHT? Check wiring");
// aht_pesent = false;
// } else{
// if(aht.getEvent(&humidity, &temp)){
// temp_out = temp.temperature;
// hum_out = humidity.relative_humidity;
// }
// aht_pesent = true;
// }
EEPROM.begin(4);
EEPROM.get(0, led_intense);
Serial.print("Led intense: ");
@@ -137,17 +143,18 @@ void loop() {
if(stled + 300 < millis()){
digitalWrite(LED_WRK, HIGH);
}
if(cRun + 1000 <= millis()){
if(cRun + 2000 <= millis()){
cRun = millis();
Serial.println(bSecs);
if(aht_pesent && aht.getEvent(&humidity, &temp)){
temp_out += (temp.temperature- temp_out) / 600;
hum_out += (humidity.relative_humidity - hum_out) / 600;
sTaH = dht.getTempAndHumidity();
if(dht.getStatus() == dht.ERROR_NONE){
temp_out += (sTaH.temperature - temp_out) / 300;
hum_out += (sTaH.humidity - hum_out) / 300;
WebSerial.print("Temp: ");
WebSerial.print(temp.temperature);
WebSerial.print(sTaH.temperature);
WebSerial.print(", Hum: ");
WebSerial.println(humidity.relative_humidity);
if(bSecs == 59){
WebSerial.println(sTaH.temperature);
if(bSecs == 29){
bSecs = 0;
digitalWrite(LED_WRK, LOW);
sprintf(v, "%.1f", temp_out);
@@ -156,7 +163,7 @@ void loop() {
client.publish(TOPIC"humout", v);
}
}
if((bSecs % 30) == 0){
if((bSecs % 15) == 0){
wMins += 0.5;
Serial.println("halfMinTick");
sprintf(v, "%.1f", wMins);

View File

@@ -18,10 +18,10 @@ void setup() {
}
Serial.println ();
#undef SCL
#undef SDA
#define SCL 32
#define SDA 33
// #undef SCL
// #undef SDA
// #define SCL 32
// #define SDA 33
Serial.print("SCL=");Serial.println (SCL);
Serial.print("SDA=");Serial.println (SDA);
//Serial.print("PWSCL=");Serial.println (PIN_WIRE_SCL);
@@ -31,9 +31,11 @@ void setup() {
byte count = 0;
Wire.begin(SDA, SCL);
for (byte i = 8; i < 120; i++)
for (byte i = 1; i < 15; i++)
{
Serial.print("Scan adr ");Serial.print(i, 16);
Wire.beginTransmission (i);
Serial.println(" beg trans");
if (Wire.endTransmission () == 0)
{
Serial.print ("Found address: ");