Bigroom PubSubClient, RGB LED

This commit is contained in:
2023-09-04 10:09:30 +03:00
parent 54db88148c
commit 84f7313123
3 changed files with 538 additions and 209 deletions

View File

@@ -11,7 +11,7 @@ extern "C" {
#include "freertos/FreeRTOS.h"
#include "freertos/timers.h"
}
#include <AsyncMqttClient.h>
//#include <AsyncMqttClient.h>
#include <leds.h>
#include "MHZ19.h"
#include <Wire.h>
@@ -23,6 +23,9 @@ extern "C" {
#include <ESPAsyncWebServer.h>
#include <WebSerial.h>
#include <AsyncElegantOTA.h>
#include <SoftwareSerial.h>
#include <SerialTransfer.h>
#include <PubSubClient.h>
#define BAUDRATE 9600
@@ -43,6 +46,7 @@ extern "C" {
#define RECIVER 18
#define TOPIC "home/bigroom/"
#define HNAME "BigRoom"
//WiFiMulti wifiMulti;
//const uint32_t connectTimeoutMs = 5000;
@@ -59,5 +63,31 @@ uint8_t statLamp;
AsyncWebServer server(80);
struct I2cTxStruct {
//byte mode, hue, saturation, bright;
byte mode, r, g, b;
};
#define SSRX 26
#define SSTX 25
I2cTxStruct txData = {0, 0x0F, 0x0F, 0x0F};
I2cTxStruct txDataN;
I2cTxStruct txDataF;
uint8_t mode = 0;
bool forceNight = false;
bool newTxData;
void transmitData();
EspSoftwareSerial::UART lampSerial;
SerialTransfer myTransfer;
long lastReconnectAttempt = 0;
WiFiClient espClient;
PubSubClient client(espClient);
boolean reconnect();
void callback(char* topic, byte* payload, unsigned int length);
#endif // __MAIN__