//konfigurasi LCD
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
//inisialisasi tombol
int status_tombol1 = 13;
int status_tombol2 = 12;
void setup(){
//inisialisasi LCD
lcd.begin(16, 2);
lcd.setCursor(0,0);
lcd.print("UPLOAD TUGAS 2");
//mengkonfigurasi pin Arduino
pinMode(13, INPUT);
pinMode(12, INPUT);
delay(1000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("BUTTON_A :");
lcd.setCursor(0,1);
lcd.print("BUTTON_B :");
}
void loop(){
status_tombol1 = digitalRead(13);
status_tombol2 = digitalRead(12);
if (status_tombol1 == HIGH) {
lcd.setCursor(10,0);
lcd.print("LED_ON");
}
else {
lcd.setCursor(10,0);
lcd.print("LED_OFF");
}
if (status_tombol2 == HIGH) {
lcd.setCursor(10,1);
lcd.print("LED_ON");
}
else {
lcd.setCursor(10,1);
lcd.print("LED_OFF");
}
}
0 komentar:
Posting Komentar