Tugas Pendahuluan Modul 1 2019




 1. Kondisi  [Kembali]

           Percobaan 3 (LCD):  Buatlah teks pada LCD berjalan ke kiri


 2. Rangkaian Simulasi [Kembali]





 3. Flowchart [Kembali]

     

 4. Listing Program [Kembali]

      #include <Keypad.h>                                //Mengaktifkan library keypad
      #include <LiquidCrystal.h>                      //Mengaktifkan library LCD    
   

LiquidCrystal lcd(12, 11, 7, 6, 5, 4);               //aktivasi pin untuk LCD

const byte BARIS = 4;                              //Pendeklarasian baris keypad dengan varibel BARIS
const byte KOLOM = 3;                           //Pendeklarasian kolom keypad dengan varibel KOLOM

char tombol[BARIS][KOLOM] = {
  {'1','2','3'},
  {'4','5','6'},                                    // Menyatakan baris dan kolom keypad dalam bentuk array.
  {'7','8','9'},                                                       
  {'#','0','*'}
};
byte bariskeypad[BARIS] = { 14, 15, 16, 17 };                                        //Menyambungkan baris keypad ke pin arduino
byte kolomkeypad[KOLOM] = { 18, 19, 20 };                                         //Menyambungkan kolom keypad ke pin arduino
Keypad kpd = Keypad( makeKeymap(tombol),bariskeypad, kolomkeypad,BARIS, KOLOM );    

void setup()                                                                 //Fungsi utama arduino
{                                                                                     //Pembuka program
  lcd.begin(16, 2);                                                         //Memulai LCD tipe 16x2
}                                                                                     //Penutup program

void loop()                                                                   //Fungsi perulangan pada arduino
  {                                                                                   //Pembuka program
    char tombol = kpd.getKey();              //Deklarasi tombol sepagai pemanggilan fungsi keypad
    if(tombol)                                                                 //Jika if  itu tombol
    {                                                                                //Pembuka program
      switch (tombol)                                                     //Jika switch itu tombol
      {                                                                              //Pembuka program
      case '1':                                                                 //Jika tombol keypad 1 ditekan
        lcd.clear();                                                           //Membersihkan LCD
        int i;
        lcd.setCursor(15,15);
        lcd.print("praktikum mikro");
        for (i = 0 ; i < 16; i++) {
        lcd.scrollDisplayLeft();
        delay(600);
        
        default:                                                                 //Jika gagal masuk ke fungsi Serial.println(tombol)
        Serial.println(tombol); 
      }
    }
  }
  else                                                                         //Fungsi kecuali jika if tidak terpenuhi
  {                                                                               //Pembuka program else
        lcd.setCursor(4,4);
        lcd.print("tekan 1"); 
  }                                                                             //Penutup program else
  }                                                                             //Penutup program utama


    5. Video Simulasi [Kembali]




6.Link Download [Kembali]
   File HTML - Download
   File Proteus - Download
   File Program - Download
   Video Simulasi - Download



[ATAS]

Tidak ada komentar:

Posting Komentar