Page 292 - 156-PENERAPAN_RANGKAIAN_ELEKTRONIKA
P. 292

PENERAPAN RANGKAIAN
                    ELEKTRONIKA

                                                          MATERI PEMBELAJARAN




                        //Program utama
                        (pengulangan)===========================================
                        ==========================
                        void loop() { utama:
                         LCD.setCursor(0,0);       //  kursor  pada  kolom  1  baris  1  LCD.
                         print(“Masukan Pass/Tag”);                //  Tampilkan  pesan  ke
                         LCD


                        //program untuk password dengan Keypad---------------------------------------
                         customKey = keypad.getKey();      //  Simpan  tombol  yang  ditekan
                        ke variabel “costumKey”
                         if (customKey)                 // Jika tombol ditekan
                         {
                          Data[data_count] = customKey;    // Menyimpan char pada  data
                        array
                          LCD.setCursor(data_count,1);   // arahkan kursor ke baris 2 kolom
                        pada data_count
                          LCD.print(“*”);             // Menampilkan char * pada LCD
                          data_count++;              // naikkan posisi kolom saat penekanan
                        berikutnya
                         }



                          if(data_count == Password_Lenght-1)  //  jika  array  data_count  sama
                        dengan password
                         {
                          LCD.clear();                     // hapus tampilan layar
                          LCD.setCursor(0,0);                // kursor pada1 kolom 1
                          LCD.print(“Password”);               // tampilkan pesan ke LCD

                          if(!strcmp(Data,  passwd)  or  !strcmp(Data,  passwd2)  )  //  equal  to
                        (strcmp(Data, Master) == 0)
                           {
                           LCD.print(“Diterima”);      //   tampilkan   pesan   ke   LCD
                           delay(1000);                // tunda 1 detik
                           label2:
                           customKey = keypad.getKey();   // Simpan tombol yang ditekan ke
                        variabel “costumKey”
                           clearData();            // kerjakan void clearData if(customKey ==
                           ‘*’)                      // jika tombol * ditekan






              TEKNIK ELEKTRONIKA                                                   277
                  INDUSTRI
   287   288   289   290   291   292   293   294   295   296   297