39 lines
765 B
C++
39 lines
765 B
C++
#include <WiFi.h>
|
|
#include <LiquidCrystal.h>
|
|
|
|
// LCD pins: RS, EN, D4, D5, D6, D7
|
|
LiquidCrystal lcd(18, 19, 13, 14, 15, 26);
|
|
|
|
const int LED_PIN = 2; // built-in LED on most ESP32 devkits
|
|
|
|
void setup() {
|
|
Serial.begin(115200);
|
|
|
|
// WiFi chip init (not connected yet)
|
|
WiFi.mode(WIFI_STA);
|
|
WiFi.disconnect();
|
|
Serial.println("WiFi initialized");
|
|
|
|
// Let LCD power up before init (ESP32 boots faster than LCD expects)
|
|
delay(500);
|
|
lcd.begin(16, 2);
|
|
lcd.clear();
|
|
|
|
pinMode(LED_PIN, OUTPUT);
|
|
}
|
|
|
|
void loop() {
|
|
Serial.println("led on!");
|
|
digitalWrite(LED_PIN, HIGH);
|
|
delay(1000);
|
|
|
|
lcd.clear();
|
|
lcd.print("Test message!");
|
|
|
|
Serial.println("led off!");
|
|
digitalWrite(LED_PIN, LOW);
|
|
delay(1000);
|
|
|
|
lcd.clear();
|
|
lcd.print("Test message2!");
|
|
}
|