LCD i2c Hello World (untested)

This commit is contained in:
2022-10-26 12:18:30 -04:00
parent baabcbcae0
commit e45dc0947d
2 changed files with 11 additions and 2 deletions

View File

@@ -12,6 +12,8 @@
platform = espressif8266
board = esp12e
framework = arduino
lib_deps = knolleary/PubSubClient@^2.8
lib_deps =
knolleary/PubSubClient@^2.8
enjoyneering/LiquidCrystal_I2C@^1.2.4
monitor_speed = 921600
upload_speed = 921600
upload_speed = 921600

View File

@@ -1,6 +1,7 @@
#include <ENC28J60lwIP.h>
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <LiquidCrystal_I2C.h>
#include <credentials.hpp>
@@ -11,6 +12,7 @@
ENC28J60lwIP ethernet(16);
WiFiClientSecure espClient;
PubSubClient client(espClient);
LiquidCrystal_I2C lcd(PCF8574A_ADDR_A21_A11_A01);
void mqttCallback(char *topic, byte *payload, unsigned int length) {
uint8_t message[256];
@@ -30,6 +32,10 @@ void mqttCallback(char *topic, byte *payload, unsigned int length) {
} else {
Serial.printf("Undefined payload value\n");
}
} else if (!strcmp(topic, ROOT_TOPIC "/display/set")) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.printf("%s", message);
} else {
// If topic is not recognized, exit without publishing to /get
Serial.printf("Unrecognized topic %s\n", topic);
@@ -129,6 +135,7 @@ void setup() {
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(921600);
Serial.println();
lcd.begin(16, 2);
BearSSL::X509List *clientTrustedCA =
new BearSSL::X509List(Credentials::ca_cert);
BearSSL::X509List *clientCertList =