#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // Alamat I2C LCD dan ukuran (16x2)
const int buttonPin = 2; // Pin digital untuk tombol
bool lcdState = false; // Status LCD (mati atau hidup)
void setup() {
lcd.begin(16, 2); // Inisialisasi LCD
lcd.setBacklight(LOW); // Matikan backlight LCD
pinMode(buttonPin, INPUT); // Mengatur pin tombol sebagai input dengan pull-up resistor internal
}
void loop() {
if (digitalRead(buttonPin) == HIGH) { // Jika tombol ditekan
lcdState = !lcdState; // Ubah status LCD (mati atau hidup)
if (lcdState) {
lcd.setBacklight(HIGH); // Hidupkan backlight LCD
lcd.setCursor(0, 0); // Mengatur posisi kursor pada baris pertama
lcd.print("KREEATOOR"); // Mencetak tulisan "KREEATOOR"
} else {
lcd.clear(); // Menghapus tampilan LCD
lcd.setBacklight(LOW); // Matikan backlight LCD
}
delay(200); // Tunggu 200ms untuk menghindari bouncing tombol
}
}
nano:12
nano:11
nano:10
nano:9
nano:8
nano:7
nano:6
nano:5
nano:4
nano:3
nano:2
nano:GND.2
nano:RESET.2
nano:0
nano:1
nano:13
nano:3.3V
nano:AREF
nano:A0
nano:A1
nano:A2
nano:A3
nano:A4
nano:A5
nano:A6
nano:A7
nano:5V
nano:RESET
nano:GND.1
nano:VIN
nano:12.2
nano:5V.2
nano:13.2
nano:11.2
nano:RESET.3
nano:GND.3
lcd1:GND
lcd1:VCC
lcd1:SDA
lcd1:SCL
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r
r1:1
r1:2