Informatika (copy) — ESP32 simulation

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

Components

Sketch code

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

// LCD alamat 0x27, ukuran 16 kolom x 2 baris
LiquidCrystal_I2C lcd(0x27, 16, 2);

const int LED_MERAH = 4;

void setup() {
  // LED sebagai OUTPUT
  pinMode(LED_MERAH, OUTPUT);

  // Memulai LCD
  lcd.init();
  lcd.backlight();

  // Kondisi awal
  digitalWrite(LED_MERAH, HIGH);

  lcd.setCursor(0, 0);
  lcd.print("Lampu merah");
  lcd.setCursor(0, 1);
  lcd.print("ON");

  delay(10000);
}

void loop() {

  // =====================
  // 🔴 LED MENYALA
  // =====================
  digitalWrite(LED_MERAH, HIGH);

  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Lampu merah");
  lcd.setCursor(0, 1);
  lcd.print("ON");

  delay(10000);


  // =====================
  // ⚫ LED MATI
  // =====================
  digitalWrite(LED_MERAH, LOW);

  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Lampu merah");
  lcd.setCursor(0, 1);
  lcd.print("OFF");

  delay(10000);
}

More projects by achmadthoriqul2