#include <LiquidCrystal.h>
char msg[] = {"Lovely professional university"};
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 4, d5 = 5, d6 = 6, d7 = 7;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int potPin = A0;
void setup() {
// initialize LCD and set up the number of columns and rows:
lcd.begin(16, 2);
lcd.print("PUNYA ALI ");
}
void loop() {
lcd.setCursor(0, 1);
int nilai = analogRead(potPin);
lcd.print(nilai);
if (nilai = 300) {
lcd. setCursor (3, 3);
lcd. print ("aman");
}
else if (nilai >500)
{
lcd. setCursor(3, 3);
lcd. print("sedang");
}
else if (nilai = 700) {
lcd. setCursor(3, 3);
lcd. print("hati hati");
}
else if (nilai = 900 ) {
lcd. setCursor(3, 3);
lcd. print ("bahaya");
}
}