percobaan 03 lcd karakter
DESCRIPTION
LCD karakterTRANSCRIPT
-
1 MIKROPOSESOR DAN ANTARMUKA| Percobaan 03: LCD Alphanumerik
PERCOBAAN 03: LCD Alphanumerik
1.1 Dasar Program LCD Karakter
A. Komponen Yang digunakan :
1. Modul Arduino
2. Modul LCD 2x16 Karakter
3. Potensiometer 10K Ohm
4. Resistor 220 Ohm
5. Kabel jumper
B. Langkah kerja :
1. Buat rangkaian sebagai berikut menggunakan protoboard
Gambar 1.1 Rangkaian LCD dan Arduino
-
2 MIKROPOSESOR DAN ANTARMUKA| Percobaan 03: LCD Alphanumerik
2. Buat program baru sebagai berikut:
#include // initialize the library with the numbers of the interface pins LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { // set up the LCD's number of columns and rows: lcd.begin(16, 2); // Print a message to the LCD. lcd.print("Mikro&Antarmuka"); } void loop() { // set the cursor to column 0, line 1 // (note: line 1 is the second row, since counting begins with 0): lcd.setCursor(0, 1); // print the number of seconds since reset: lcd.print(millis() / 1000); }
3. Lihat hasilnya pada Tampilan LCD.
4. Coba semua contoh program LCD bawaan arduino melalui menu : File => Examples =>
LiquidCrystal => nama_contoh
5. Jalankan program dan amati tampilan LCD
C. Tugas Buat tampilan LCD sebagai berikut :
- Baris atas : NAMA
- Baris bawah : NIM
- Kedua baris bergerak ke kiri hingga semua karakter hilang, kemudian bergerak ke
kanan hingga semua karakter hilang. Demikian berulang-ulang.
-
3 MIKROPOSESOR DAN ANTARMUKA| Percobaan 03: LCD Alphanumerik
1.2 Tampilan LCD dengan Input Digital
A. Langkah kerja :
1. Tambahkan rangkaian skema tombol berikut ke rangkaian pada Gambar 1.1
Gambar 3.2 Rangkaian Tombol
2. Buat program sebagai berikut
#include const int switchPin = 8; const int ledPin = 13; int state; int lastState; int buttonCounter = 0; // initialize the library with the numbers of the interface pins LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { // set up the LCD's number of columns and rows: lcd.begin(16, 2); // Print a message to the LCD. lcd.print("Mikro&Antarmuka"); Serial.begin(9600); pinMode(switchPin, INPUT); pinMode(ledPin, OUTPUT); } void loop() { // set the cursor to column 0, line 1 // (note: line 1 is the second row, since counting begins with 0): lcd.setCursor(0, 1); // print the number of seconds since reset:
-
4 MIKROPOSESOR DAN ANTARMUKA| Percobaan 03: LCD Alphanumerik
state = digitalRead(switchPin); if (state != lastState) { if (state == HIGH) { if (buttonCounter