.:: Jasa Membuat Aplikasi Website,Desktop,Android Order Now..!! | | Order Now..!! Jasa Membuat Project Arduino,Robotic,Print 3D ::.

Mengakses Keypad Matrix Sebagai Input Waktu Arduino

0 komentar


بِسْــــــــــــــــمِ اﷲِالرَّحْمَنِ اارَّحِيم
bismillaahirrahmaanirrahiim

السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
Assalamu'alaikum warahmatullahi wabarakatuh

Mengakses Keypad Matrix Sebagai Input Waktu Arduino


             Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara mengakses sebuah device yaitu keypad matrix 4x4 menggunakan kontroller Arduino. Alat ini difungsikan sebagai input waktu atau pengatur waktu, jadi prinsip kerjanya seperti berikut. terdapat dua buah input waktu yaitu waktu pertama dan waktu kedua, waktu pertama terdapat dua buah parameter yaitu jam dan menit, begitu pula dengan waktu kedua. terdapat LCD yang berfungsi sebagai tampilan input yang di set. untuk lebih jelasnya berikut adalah program dan skemanya.



a. Arduino Mega





b. Keypad Matrix 4x4





c. LCD Display 16x2





d. Program Arduino IDE

#include <Keypad.h>
#include <Wire.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

long first = 0;
long firstx = 0;

long second = 0;
long menit1 = 0;
int jamon1x = 0;
int menon1x = 0;

long second2 = 0;
long menit2 = 0;
int jamon2x = 0;
int menon2x = 0;


char customKey;
const byte ROWS = 4;
const byte COLS = 4;

char keys[ROWS][COLS] = {
{'D', 'C', 'B', 'A'},
{'#', '9', '6', '3'},
{'0', '8', '5', '2'},
{'*', '7', '4', '1'}
};
byte rowPins[ROWS] = {A0,A1,A2,A3}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {A4,A5,A6,A7}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS);

void setup()
{
  lcd.begin(16, 2);
  lcd.clear();
  lcd.noCursor();
   
}


void loop()
{
  customKey = customKeypad.getKey();
 
  lcd.setCursor(0,1);
   lcd.print(jamon1x);
   lcd.print(" ");
   lcd.print(menon1x);
   lcd.print(" "); 
   lcd.print(jamon2x);
   lcd.print(" ");
   lcd.print(menon2x);
  
  
  
  switch(customKey)
  {
  case '0' ... '9': // This keeps collecting the first value until a operator is pressed "+-*/"
    lcd.setCursor(0,0);
    first = first * 10 + (customKey - '0');
    lcd.print(first);
    
    if(first == 13){
      first = 0;
      delay(1000);
      lcd.clear();
   
     jamon1();
    
    }
   
    if(first == 12){
     delay(1000);
     lcd.clear();
    
     jamon2();

   
    }
   
    break;

  case '#':
   
   
 
    break;

  case '*':
    lcd.clear();
    first = 0;
    break;
  case 'C':
    break;
  case 'D':
    break;


  }
}


void jamon1(){
    while( 1 )
  {
customKey = customKeypad.getKey();
 lcd.setCursor(0,1);
 lcd.print("jam on1");
    if(customKey >= '0' && customKey <= '9')
    {
      second = second * 10 + (customKey - '0');
      lcd.setCursor(0,0);
      lcd.print(second);
    }
   
    if(customKey == 'B'){
      jamon1x = second;
      lcd.clear();
      delay(1000);
      menon1();
    }
    if(customKey == 'A'){
      return;
    }
   
  }
 

 
 }



void menon1(){
  while( 1 )
  {
customKey = customKeypad.getKey();
 lcd.setCursor(0,1);
 lcd.print("menit on1");
    if(customKey >= '0' && customKey <= '9')
    {
      menit1 = menit1 * 10 + (customKey - '0');
      lcd.setCursor(0,0);
      lcd.print(menit1);
     
    }
   
    if(customKey == 'A'){
      menon1x = menit1;
      lcd.clear();
      delay(1000);
      return;
    }
       
   
  }
   
}



void jamon2(){
    while( 1 )
  {
customKey = customKeypad.getKey();
 lcd.setCursor(0,1);
 lcd.print("jam on2");
    if(customKey >= '0' && customKey <= '9')
    {
      second2 = second2 * 10 + (customKey - '0');
      lcd.setCursor(0,0);
      lcd.print(second2);
    }
   
    if(customKey == 'B'){
      jamon2x = second2;
      lcd.clear();
      delay(1000);
      menon2();
    }
    if(customKey == 'A'){
      return;
    }
   
  }
 

 
 }



void menon2(){
  while( 1 )
  {
customKey = customKeypad.getKey();
 lcd.setCursor(0,1);
 lcd.print("menit on2");
    if(customKey >= '0' && customKey <= '9')
    {
      menit2 = menit2 * 10 + (customKey - '0');
      lcd.setCursor(0,0);
      lcd.print(menit2);
     
    }
   
    if(customKey == 'A'){
      menon2x = menit2;
      lcd.clear();
      delay(1000);
      return;
    }
       
  }
   
}





e. VIDEO HASILNYA











Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
NB :: Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code, membeli hardware elektronika untuk kepentingan Perusahaan maupun Tugas Akhir (TA/SKRIPSI), Insyaallah Saya siap membantu, untuk Respon Cepat dapat menghubungi kami, melalui :

No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com


atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :

ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِين
Alhamdulilah hirobil alamin

وَ السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
wassalamualaikum warahmatullahi wabarakatuh


Artikel Mengakses Keypad Matrix Sebagai Input Waktu Arduino , Diterbitkan oleh scodeaplikasi pada Minggu, 24 Juli 2016. Semoga artikel ini dapat menambah wawasan Anda. Website ini dipost dari beberapa sumber, bisa cek disini sumber, Sobat diperbolehkan mengcopy paste / menyebar luaskan artikel ini, karena segala yang dipost di public adalah milik public. Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code ,Dengan Cara menghubungi saya Ke Email: Fajarudinsidik@gmail.com, atau No Hp/WA : (fajar) : 085369237896, (puat) : 085267792168.

Tawk.to