PERCOBAAN 4
KEYPAD & LCD
1. Rangkai rangkaian di proteus sesuai dengan kondisi percobaan.
2. Tulis program untuk arduino di software Arduino IDE.
3. Compile program tadi, lalu upload ke dalam arduino.
4. Setelah program selesai di upload, jalankan simulasi rangkaian pada proteus.
2. Tulis program untuk arduino di software Arduino IDE.
3. Compile program tadi, lalu upload ke dalam arduino.
4. Setelah program selesai di upload, jalankan simulasi rangkaian pada proteus.
2. Hardware dan Diagram Blok
[Kembali]
3. Rangkaian Simulasi dan Prinsip Kerja [Kembali]
Rangkaian Simulasi
Rangkaian ini dibuat dengan beberapa komponen, seperti mikrokontroler, keypad, potensiometer, dan LCD. Cara kerjanya:
- Keypad 3x4 digunakan untuk memasukkan data.
- LCD digunakan untuk menampilkan data.
- Potensiometer digunakan untuk mengatur kontras dan tegangan pada LCD.
Program Arduino yang dibuat berisi tabel 3x4 yang mewakili susunan tombol pada keypad. Setiap karakter dalam tabel mewakili tombol pada keypad. Ketika tombol ditekan, LCD akan menampilkan teks "Tombol: (tombol yang ditekan)".
ketika tombol 1 ditekan, LCD akan menampilkan "Tombol: 1". Hal yang sama berlaku untuk tombol "#", "*", dan tombol 0-9.
Soal Analisa
Flowchart
Listing Program :
#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);
}
}
penundaan agar tampilan tidak berubah terlalu cepat
}
Kondisi : Percobaan 1 Sesuai modul
Button 1 - 8 menghidupkan LED
6. Video Simulasi [Kembali]
HTML klik disini
File Rangkaian klik disini
Video Percobaan klik disini
Video Percobaan klik disini
Listing Program klik disini
Datasheet Arduino klik disini
Download Datasheet LCD Klik Disini
Download Datasheet Keypad 3x4 Klik Disini
Tidak ada komentar:
Posting Komentar