// Learn about the ESP32 WiFi simulation in
// https://docs.wokwi.com/guides/esp32-wifi
#include <WiFi.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 20, 4);
void setup() {
Serial.begin(115200);
lcd.init();
lcd.backlight();
}
union FloatConverter {
float asFloat = 0.00f;
uint8_t asByte[4];
} currentValue_rx , voltageValue_rx , powerValue_rx , temperature_rx , humidity_rx , servoX_tx , servoZ_tx; // 20 Bytes
union Int16Converter {
int16_t asInt = 0;
uint8_t asByte[2];
}top1Value_rx , toprValue_rx , bot1Value_rx , botrValue_rx , fn_tx; // 8 Bytes;
bool manualMode = false;
bool isOnline = false;
float topLValue , topRValue , botLValue , botRValue;
// V: A: Auto/Manual
// TEMP:°C Humi: %RH
// TL: TR:
// BL: BR:
void loop() {
static int8_t rssi = 0;
static unsigned long premillis = 0;
if (millis() - premillis >= 1000) {
rssi = WiFi.RSSI();
premillis = millis();
}
lcd.setCursor(0, 0);
lcd.print("V:");
lcd.print(String(0.00 , 1));
lcd.setCursor(0, 2);
lcd.print("TL:");
lcd.print(topLValue);
lcd.print("% ");
lcd.setCursor(7, 2);
lcd.print("TR:");
lcd.print(topRValue);
lcd.print("% ");
lcd.setCursor(14, 2);
lcd.print("V:");
lcd.print(String(voltageValue_rx.asFloat , 1));
lcd.setCursor(0, 3);
lcd.print("BL:");
lcd.print(botLValue);
lcd.print("% ");
lcd.setCursor(7, 3);
lcd.print("BR:");
lcd.print(botRValue);
lcd.print("% ");
lcd.setCursor(14, 3);
lcd.print("A:");
lcd.print(String(currentValue_rx.asFloat , 1));
lcd.setCursor(0, 1);
lcd.print("T:");
lcd.print(temperature_rx.asFloat);
lcd.print(223);
lcd.setCursor(12, 1);
lcd.print("H:");
lcd.print(humidity_rx.asFloat);
lcd.print("%");
}