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 ayushsharma82/WebSerial @ ^1.3.0
ottowinter/ESPAsyncWebServer-esphome @ ^3.0.0 ottowinter/ESPAsyncWebServer-esphome @ ^3.0.0
lewapek/Nova Fitness Sds dust sensors library @ ^1.5.1 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 crankyoldgit/IRremoteESP8266 @ ^2.8.2
ayushsharma82/WebSerial @ ^1.3.0 ayushsharma82/WebSerial @ ^1.3.0
ottowinter/ESPAsyncWebServer-esphome @ ^3.0.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 ;joaolopesf/RemoteDebug @ 3.0.5

View File

@@ -7,6 +7,9 @@
; ;
; Please visit documentation for the other options and examples ; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html ; 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] [env:d1_mini]
platform = espressif8266 platform = espressif8266
@@ -17,11 +20,10 @@ upload_port = 192.168.1.136
lib_deps = lib_deps =
;enjoyneering/AHT10@^1.1.0
;ottowinter/AsyncMqttClient-esphome @ ^0.8.6
knolleary/PubSubClient @ ^2.8 knolleary/PubSubClient @ ^2.8
ottowinter/ESPAsyncWebServer-esphome @ ^2.1.0 ottowinter/ESPAsyncWebServer-esphome @ ^2.1.0
ayushsharma82/AsyncElegantOTA @ ^2.2.6 ayushsharma82/AsyncElegantOTA @ ^2.2.6
ayushsharma82/WebSerial @ ^1.3.0 ayushsharma82/WebSerial @ ^1.3.0
jwrw/ESP_EEPROM @ ^2.0.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 <Arduino.h>
#include <Adafruit_AHTX0.h> //#include <Adafruit_AHTX0.h>
#include "DHTesp.h"
#include <ArduinoOTA.h> #include <ArduinoOTA.h>
#include <Ticker.h> #include <Ticker.h>
#include <ESP8266WiFi.h> #include <ESP8266WiFi.h>
@@ -24,8 +25,11 @@
#define LAMP_OUT (D5) #define LAMP_OUT (D5)
Adafruit_AHTX0 aht; //Adafruit_AHTX0 aht;
sensors_event_t humidity, temp; DHTesp dht;
TempAndHumidity sTaH;
//sensors_event_t humidity, temp;
float temp_out, hum_out; float temp_out, hum_out;
WiFiClient espClient; WiFiClient espClient;
@@ -94,16 +98,18 @@ void setup() {
pinMode(LED_MQ, OUTPUT); pinMode(LED_MQ, OUTPUT);
pinMode(LED_WRK, OUTPUT); pinMode(LED_WRK, OUTPUT);
pinMode(LAMP_OUT, OUTPUT); pinMode(LAMP_OUT, OUTPUT);
if (! aht.begin()) { dht.setup(D1, DHTesp::DHT22);
Serial.println("Could not find AHT? Check wiring"); delay(dht.getMinimumSamplingPeriod());
aht_pesent = false; // if (! aht.begin()) {
} else{ // Serial.println("Could not find AHT? Check wiring");
if(aht.getEvent(&humidity, &temp)){ // aht_pesent = false;
temp_out = temp.temperature; // } else{
hum_out = humidity.relative_humidity; // if(aht.getEvent(&humidity, &temp)){
} // temp_out = temp.temperature;
aht_pesent = true; // hum_out = humidity.relative_humidity;
} // }
// aht_pesent = true;
// }
EEPROM.begin(4); EEPROM.begin(4);
EEPROM.get(0, led_intense); EEPROM.get(0, led_intense);
Serial.print("Led intense: "); Serial.print("Led intense: ");
@@ -137,17 +143,18 @@ void loop() {
if(stled + 300 < millis()){ if(stled + 300 < millis()){
digitalWrite(LED_WRK, HIGH); digitalWrite(LED_WRK, HIGH);
} }
if(cRun + 1000 <= millis()){ if(cRun + 2000 <= millis()){
cRun = millis(); cRun = millis();
Serial.println(bSecs); Serial.println(bSecs);
if(aht_pesent && aht.getEvent(&humidity, &temp)){ sTaH = dht.getTempAndHumidity();
temp_out += (temp.temperature- temp_out) / 600; if(dht.getStatus() == dht.ERROR_NONE){
hum_out += (humidity.relative_humidity - hum_out) / 600; temp_out += (sTaH.temperature - temp_out) / 300;
hum_out += (sTaH.humidity - hum_out) / 300;
WebSerial.print("Temp: "); WebSerial.print("Temp: ");
WebSerial.print(temp.temperature); WebSerial.print(sTaH.temperature);
WebSerial.print(", Hum: "); WebSerial.print(", Hum: ");
WebSerial.println(humidity.relative_humidity); WebSerial.println(sTaH.temperature);
if(bSecs == 59){ if(bSecs == 29){
bSecs = 0; bSecs = 0;
digitalWrite(LED_WRK, LOW); digitalWrite(LED_WRK, LOW);
sprintf(v, "%.1f", temp_out); sprintf(v, "%.1f", temp_out);
@@ -156,7 +163,7 @@ void loop() {
client.publish(TOPIC"humout", v); client.publish(TOPIC"humout", v);
} }
} }
if((bSecs % 30) == 0){ if((bSecs % 15) == 0){
wMins += 0.5; wMins += 0.5;
Serial.println("halfMinTick"); Serial.println("halfMinTick");
sprintf(v, "%.1f", wMins); sprintf(v, "%.1f", wMins);
@@ -240,4 +247,4 @@ void reconnect() {
} }
} }
digitalWrite(LED_MQ, HIGH); digitalWrite(LED_MQ, HIGH);
} }

View File

@@ -18,10 +18,10 @@ void setup() {
} }
Serial.println (); Serial.println ();
#undef SCL // #undef SCL
#undef SDA // #undef SDA
#define SCL 32 // #define SCL 32
#define SDA 33 // #define SDA 33
Serial.print("SCL=");Serial.println (SCL); Serial.print("SCL=");Serial.println (SCL);
Serial.print("SDA=");Serial.println (SDA); Serial.print("SDA=");Serial.println (SDA);
//Serial.print("PWSCL=");Serial.println (PIN_WIRE_SCL); //Serial.print("PWSCL=");Serial.println (PIN_WIRE_SCL);
@@ -31,9 +31,11 @@ void setup() {
byte count = 0; byte count = 0;
Wire.begin(SDA, SCL); 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); Wire.beginTransmission (i);
Serial.println(" beg trans");
if (Wire.endTransmission () == 0) if (Wire.endTransmission () == 0)
{ {
Serial.print ("Found address: "); Serial.print ("Found address: ");