Percobaan 4 Keypad & LCD
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. Hardware
2. Diagram Blok
3. Rangkaian Simulasi dan Prinsip kerja
[Kembali]
PRINSIP KERJA
Rangkaian ini terdiri dari beberapa komponen, termasuk mikrokontroler (ATMEGA328P-PU), keypad, potensiometer, dan LCD. Prinsip kerja rangkaian ini adalah bahwa keypad 3x4 bertindak sebagai input, sementara LCD bertindak sebagai output, dan potensiometer digunakan untuk mengatur kontras dan tegangan pada LCD. Program Arduino yang telah dibuat mencakup sebuah array matriks 3x4 yang merepresentasikan layout keypad, di mana setiap karakter terkait dengan tombol pada keypad. Jadi, ketika tombol pada keypad ditekan, teks "Tombol: (tombol yang ditekan)" akan ditampilkan pada LCD. Contohnya, ketika tombol 1 ditekan, LCD akan menampilkan "Tombol: 1", dan hal yang sama berlaku untuk tombol "#" (pound), "*", dan tombol 0-9.
Soal Analisa
4. FlowChart [Kembali]
#include <Keypad.h>
#include <LiquidCrystal.h>
// Constants for row and column sizes
const byte ROWS = 4;
const byte COLS = 4;
// Array to represent keys on keypad
char hexaKeys[ROWS][COLS] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
// Connections to Arduino
byte rowPins[ROWS] = {9, 8, 7, 6};
byte colPins[COLS] = {5, 4, 3, 2};
// Create keypad object
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);
void setup() {
// Setup serial monitor
Serial.begin(9600);
lcd.begin(16, 2);
}
void loop() {
// Get key value if pressed
char customKey = customKeypad.getKey();
if (customKey) {
// Print key value to serial monitor
lcd.setCursor(0, 0);
lcd.print("Tombol :");
lcd.print(customKey);
}
}
#include <LiquidCrystal.h>
// Constants for row and column sizes
const byte ROWS = 4;
const byte COLS = 4;
// Array to represent keys on keypad
char hexaKeys[ROWS][COLS] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
// Connections to Arduino
byte rowPins[ROWS] = {9, 8, 7, 6};
byte colPins[COLS] = {5, 4, 3, 2};
// Create keypad object
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);
void setup() {
// Setup serial monitor
Serial.begin(9600);
lcd.begin(16, 2);
}
void loop() {
// Get key value if pressed
char customKey = customKeypad.getKey();
if (customKey) {
// Print key value to serial monitor
lcd.setCursor(0, 0);
lcd.print("Tombol :");
lcd.print(customKey);
}
}
b. Flowchart
5. Kondisi [Kembali]Kondisi : Percobaan 4 Sesuai modul
6. Video Simulasi [Kembali]
7. Download File
[Kembali]
Download HTML Klik disini
Download Video Simulasi Klik disini
Download Datasheet ARDUINO UNO klik disini
Download Datasheet LCD Klik disini
Download Datasheet Keypad 4x4 Klik Disini
Tidak ada komentar:
Posting Komentar