0% found this document useful (0 votes)
49 views3 pages

SARINTO (17157783) Teknik Elektro

This Arduino code controls an LCD display and 3 buttons/LEDs. When the buttons are pressed, it displays a message on the LCD like "MCB 1 TRIP" and turns on the corresponding LED. It initializes pin connections, sets the LCD, and continuously checks the button states in a loop. If a button is pressed, it displays a trip message on the LCD and lights the LED for 2 seconds, then turns it off when released. It also displays welcome messages on startup.

Uploaded by

Sarinto 81
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views3 pages

SARINTO (17157783) Teknik Elektro

This Arduino code controls an LCD display and 3 buttons/LEDs. When the buttons are pressed, it displays a message on the LCD like "MCB 1 TRIP" and turns on the corresponding LED. It initializes pin connections, sets the LCD, and continuously checks the button states in a loop. If a button is pressed, it displays a trip message on the LCD and lights the LED for 2 seconds, then turns it off when released. It also displays welcome messages on startup.

Uploaded by

Sarinto 81
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

#include <LiquidCrystal.

h> SARINTO ( 17157783 )


const int rs=7, en=6, d4=5, d5=4, d6=3, d7=2;
TEKNIK ELEKTRO
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

const int tombol1 = 13;

const int tombol2 = 12;

const int tombol3 = 11;

const int led1 = 10;

const int led2 = 9;

const int led3 = 8;

int posisitombol1=0;

int posisitombol2=0;

int posisitombol3=0;

void setup() {

pinMode(tombol1, INPUT);

pinMode(tombol2, INPUT);

pinMode(tombol3, INPUT);

pinMode(led1, OUTPUT);

pinMode(led2, OUTPUT);

pinMode(led3, OUTPUT);

lcd.begin(16,2);

void loop() {

if (posisitombol1,posisitombol2,posisitombol3 == LOW);{

lcd.clear();

lcd.begin(16,2);

lcd.setCursor(3,0);

lcd.print("WELCOME TO");
lcd.setCursor(1,1);

lcd.print("STT DUTA BANGSA");

delay(500);

lcd.clear();

lcd.begin(16,2);

lcd.setCursor(0,0);

lcd.print("SARINTO 17157783");

lcd.setCursor(1,1);

lcd.print("TEHNIK ELEKTRO");

delay(500);

posisitombol1 = digitalRead(tombol1);

if (posisitombol1 == HIGH){

digitalWrite(led1, HIGH);

lcd.clear();

lcd.setCursor(6,0);

lcd.print("MCB 1");

lcd.setCursor(7,1);

lcd.print("TRIP");

delay(2000);

if (posisitombol1 == LOW){

digitalWrite(led1, LOW);

posisitombol2 = digitalRead(tombol2);

if (posisitombol2 == HIGH){

digitalWrite(led2, HIGH);

lcd.clear();
lcd.setCursor(6,0);

lcd.print("MCB 2");

lcd.setCursor(7,1);

lcd.print("TRIP");

delay(2000);

if (posisitombol2 == LOW){

digitalWrite(led2, LOW);

posisitombol3 = digitalRead(tombol3);

if (posisitombol3 == HIGH){

digitalWrite(led3, HIGH);

lcd.clear();

lcd.setCursor(6,0);

lcd.print("MCB 3");

lcd.setCursor(7,1);

lcd.print("TRIP");

delay(2000);

if (posisitombol3 == LOW){

digitalWrite(led3, LOW);

You might also like