code template for esp32 added, mb need to change ino for rs
This commit is contained in:
parent
f0d7abdf0e
commit
4fbd2eaf10
1 changed files with 39 additions and 0 deletions
39
esp32/esp32_quiz/esp32_quiz.ino
Normal file
39
esp32/esp32_quiz/esp32_quiz.ino
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#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!");
|
||||
}
|
||||
Loading…
Reference in a new issue