Lcd Ezhar 2 (copy) (copy) 2 — ESP32 simulation

An interactive ESP32 circuit simulation you can run free in your browser on Velxio, by ventoauro9.

Components

Sketch code

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <ESP32Servo.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);
Servo myServo;

const int ledPin = 4;
const int servoPin = 18;

void setup() {
  pinMode(ledPin, OUTPUT);
  Wire.begin(21,22);
  lcd.init();
  lcd.backlight();

  myServo.attach(servoPin);
  myServo.write(0);
}

void loop() {
  digitalWrite(ledPin, LOW);
  myServo.write(0);
  lcd.setCursor(0, 0);
  lcd.print("Servo: 0 Deg   ");
  lcd.setCursor(0, 1);
  lcd.print("LED: OFF        ");
  delay(2000);

  digitalWrite(ledPin, HIGH);
  myServo.write(90);
  lcd.setCursor(0, 0);
  lcd.print("Servo: 90 Deg  ");
  lcd.setCursor(0, 1);
  lcd.print("LED: ON        ");
  delay(2000);

  digitalWrite(ledPin, HIGH);
  myServo.write(180);
  lcd.setCursor(0, 0);
  lcd.print("Servo: 180 Deg ");
  lcd.setCursor(0, 1);
  lcd.print("LED: ON        ");
  delay(2000);
}

More projects by ventoauro9