Selamat datang di blog Indo Tech Bro, pada kesempatan kali ini kita akan membahas penggunaan Keypad dan LCD. Pertama-tama siapkan dulu komponen yang dibutuhkan sebagai berikut :
Kemudian rangkai komponen seperti
dibawah ini :
Keypad dimasukan ke pin digital
11,10,9,8 hingga 7,6,5,4
Untuk LCD VCC ke 5V, GND ke GND,
SDA ke pin SDA, SCL ke pin SCL
Library yang dibutuhkan :
#include <LiquidCrystal_I2C.h>
#include <Key.h>
#include <Keypad.h>
Untuk source code full :
#include <LiquidCrystal_I2C.h>
#include <Key.h>
#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 4;
char hexaKeys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {11,10,9,8}; //pin baris
byte colPins[COLS] = {7,6,5,4}; //pin kolom
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
String karakter;
//membuat LCD
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
lcd.backlight();
lcd.begin();
lcd.setCursor(2,0);
lcd.print("TUTOR LCD");
delay(2000);
lcd.clear();
}
void loop() {
// put your main code here, to run repeatedly:
karakter = customKeypad.getKey();
if(karakter){
Serial.print(karakter);
lcd.setCursor(0, 0);
lcd.print(karakter);
}
}
Hasil serta pembahasan di Youtube
:
1. Arduino : https://tokopedia.link/LUkVMSdipIb 2. Case Acrylic : https://tokopedia.link/PNTPrf1MqIb 3. Keypad 4x4 : https://tokopedia.link/49tPQingxIb 4. LCD beserta modul I2C : https://tokopedia.link/lS7I74909Ib 5. Kabel Jumper : https://tokopedia.link/shUo5iYMqIb
#arduino #tutorialarduinoindonesia #tutorialarduino #keypad #lcd #diy #technology #craft #learning
THANK YOU :)
SEE YOU IN THE NEXT POST !

.jpeg)




0 Komentar