Tugas Pendahuluan 2

 




Percobaan 6
Push Button dan LCD

1. Prosedur
 [Kembali]

1. Rangkai semua komponen sesuai kondisi yang dipilih
2. buat program di aplikasi arduino IDE
3. setelah selesai masukkan program ke arduino di proteus
4.  jalankan program pada simulasi dan cobakan sesuai dengan modul dan kondisi
5. Selesai

2. Hardware dan diagram blok [Kembali]
      1. Arduino Uno

            
    

      2. SW-SPDT
       
 



      3. LM016L
 


 

      4. Power Supply
      5. Ground

Diagram Blok :




3. Rangkaian Simulasi dan Prinsip kerja [Kembali]

→ Gambar Rangkaian Sebelum Disimulasikan
                                   




→ Gambar Rangkaian Setelah Disimulasikan
       





PRINSIP KERJA

    Rangkaian menggunakan Arduino dan output LCD dengan kondisi 8 tombol (Button) yang masing-masing menampilkan huruf A hingga H secara berurut pada kolom 2 LCD bekerja dengan cara sebagai berikut: saat salah satu tombol ditekan, Arduino membaca sinyal masukan dari tombol yang ditekan. Berdasarkan nomor pin tombol yang ditekan, Arduino menentukan huruf yang sesuai dari array huruf yang telah ditentukan. Selanjutnya, Arduino mengirimkan perintah ke LCD untuk menampilkan huruf tersebut pada kolom kedua LCD. Proses ini terjadi berulang kali dalam loop utama program, sehingga ketika tombol lainnya ditekan, Arduino akan terus memperbarui tampilan pada LCD sesuai dengan tombol yang ditekan.

4. FlowChart [Kembali]

a. Listing Program 

#include <LiquidCrystal.h>
#define PB1 A0
#define PB2 A1
#define PB3 A2
#define PB4 A3
#define PB5 A4
#define PB6 A5
#define PB7 12
#define PB8 13
const int rs = 11, en = 10, d4 = 6, d5 = 5, d6 = 4, d7 = 3;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
bool Button1,Button2,Button3,Button4,Button5,Button6,Button7,Button8;
void setup() {
 Serial.begin(9600);
 lcd.begin(16,2);
 pinMode(PB1, INPUT);
 pinMode(PB2, INPUT);
 pinMode(PB3, INPUT);
 pinMode(PB4, INPUT);
 pinMode(PB5, INPUT);
 pinMode(PB6, INPUT);
 pinMode(PB7, INPUT);
 pinMode(PB8, INPUT);
}
void loop() {
 Button1 = digitalRead(PB1);
 Button2 = digitalRead(PB2);
 Button3 = digitalRead(PB3);
 Button4 = digitalRead(PB4);
 Button5 = digitalRead(PB5);
 Button6 = digitalRead(PB6);
 Button7 = digitalRead(PB7);
 Button8 = digitalRead(PB8);
 if(Button1==HIGH & Button2==LOW & Button3==LOW & Button4==LOW & Button5==LOW &
Button6==LOW & Button7==LOW & Button8==LOW){
 lcd.clear();
 lcd.setCursor(0, 1);
 lcd.print("A");
 }
 else if(Button2==HIGH & Button1==LOW & Button3==LOW & Button4==LOW & Button5==LOW
& Button6==LOW & Button7==LOW & Button8==LOW){
 lcd.clear();
 lcd.setCursor(0, 1);
 lcd.print("B");
 }
 else if(Button3==HIGH & Button2==LOW & Button1==LOW & Button4==LOW & Button5==LOW
& Button6==LOW & Button7==LOW & Button8==LOW){
 lcd.clear();
 lcd.setCursor(0, 1);
 lcd.print("C");
 }
 else if(Button4==HIGH & Button2==LOW & Button3==LOW & Button1==LOW & Button5==LOW
& Button6==LOW & Button7==LOW & Button8==LOW){
 lcd.clear();
 lcd.setCursor(0, 1);
 lcd.print("D");
 }
 else if(Button5==HIGH & Button2==LOW & Button3==LOW & Button4==LOW & Button1==LOW
 & Button6==LOW & Button7==LOW & Button8==LOW){
 lcd.clear();
 lcd.setCursor(0, 1);
 lcd.print("E");
 }
 else if(Button6==HIGH & Button2==LOW & Button3==LOW & Button4==LOW & Button5==LOW
& Button1==LOW & Button7==LOW & Button8==LOW){
 lcd.clear();
 lcd.setCursor(0, 1);
 lcd.print("F");
 }
 else if(Button7==HIGH & Button2==LOW & Button3==LOW & Button4==LOW & Button5==LOW
& Button6==LOW & Button1==LOW & Button8==LOW){
 lcd.clear();
 lcd.setCursor(0, 1);
 lcd.print("G");
 }
 else if(Button8==HIGH & Button2==LOW & Button3==LOW & Button4==LOW & Button5==LOW
& Button6==LOW & Button7==LOW & Button1==LOW){
 lcd.clear();
 lcd.setCursor(0, 1);
 lcd.print("H");
 }
 else if(Button1==LOW & Button2==LOW & Button3==LOW & Button5==LOW & Button5==LOW
& Button6==LOW & Button7==LOW & Button8==LOW){
 lcd.clear();
 lcd.setCursor(0, 0);
 lcd.print("Silahkan Tekan");
 lcd.setCursor(0, 1);
 lcd.print("Salah Satu SW");
 }
 else{
 lcd.clear();
 lcd.setCursor(0, 0);
 lcd.print("Error");
 }
 delay(100); // Tambahkan penundaan agar tampilan tidak berubah terlalu cepat
}

b. Flowchart



5. Kondisi [Kembali]

Kondisi  : Percobaan 6 Kondisi 2

       Button 1 - 8 menampilkan huruf A - H secara berurut kolom 2



6. Video Simulasi [Kembali]



7. Download File [Kembali]

Download Simulasi Rangkaian Klik disini
Download HTML Klik disini
Download Video Simulasi Klik disini
Download Listing Code Klik Disini
Download Datasheet ARDUINO UNO klik disini
Download Datasheet SW - SPDT Klik Disini
Download Datasheet LM016L Klik Disini







Tidak ada komentar:

Posting Komentar

                       BAHAN PRESENTASI UNTUK MATA KULIAH ELEKTRONIKA  2021/2022 Oleh : Fauzan Alfitrah 2110952002 Dosen Pengampu : Dr. Darw...