Kuhnya Changed IP for MQTT. Added JLed

This commit is contained in:
Lexa
2025-08-21 11:07:47 +03:00
parent 4406739f56
commit c42f26105c
35 changed files with 2279 additions and 15 deletions

View File

@@ -14,6 +14,7 @@
#include <EEPROM.h>
#include <Ticker.h>
#include <AsyncMqttClient.h>
#include <jled.h>
//#include <Adafruit_BME280.h>
@@ -36,7 +37,7 @@ uint16_t stat[4];
const char* ssid = "wf-home";
const char* password = "0ndthnrf";
const char* mqtt_server = "192.168.1.111";
const char* mqtt_server = "192.168.1.10";
#define TOPIC "home/"
unsigned long crun;

View File

@@ -18,5 +18,6 @@ lib_deps =
finitespace/BME280 @ ^3.0.0
milesburton/DallasTemperature @ ^3.9.1
thomasfredericks/Bounce2 @ ^2.55
mathertel/LiquidCrystal_PCF8574 @ ^1.2.0
https://github.com/mathertel/LiquidCrystal_PCF8574.git
marvinroger/AsyncMqttClient @ ^0.8.2
jandelgado/JLed @ ^4.15.0

View File

@@ -12,6 +12,7 @@ LiquidCrystal_PCF8574 lcd(0x3F); // set the LCD address to 0x27 for a 16 chars a
WiFiClient espClient;
Bounce butt = Bounce();
auto gLed = JLed(GREEN);
float tempC;
char f[4];
@@ -116,14 +117,16 @@ void setup() {
connectToWifi();
crun = millis();
gLed.Breathe(2000).DelayAfter(1000).MaxBrightness(16).Forever();
}
void loop() {
float tempT(NAN), humT(NAN), pressT(NAN);
static int gint = 1;
static bool gdir = true;
// static int gint = 1;
// static bool gdir = true;
ArduinoOTA.handle();
gLed.Update();
butt.update();
if (butt.rose()){
@@ -135,10 +138,10 @@ void loop() {
crun = millis();
minCount++;
if(gdir) gint += 25;
else gint -= 25;
if((gint > 499) || (gint < 2)) gdir = !gdir;
analogWrite(GREEN, gint);
// if(gdir) gint += 25;
// else gint -= 25;
// if((gint > 499) || (gint < 2)) gdir = !gdir;
// analogWrite(GREEN, gint);
adc = analogRead(A0);
mv = digitalRead(MOVE_S);