Using Arduino 16x2 LCD Keypad Shield
Using Arduino 16x2 LCD Keypad Shield
Today, in this article, I will tell you how you can use the LCD Keypad Shield module with Arduino and which pins are left open. Let's get right into the article without further ado.
Placing the Shield onto Arduino
The pins on the shield are inserted so that they fit perfectly onto the Arduino and pressed down. When the pins are completely seated, it means the shield is now ready to work together with Arduino.
Let's Look at the Pins on the Shield
There are 7 pins on the shield, and these pins correspond to the following pins on the Arduino, from left to right: 13, 12,11,3,2,1,0
The pins located at the bottom are Reset, 3.3V, 5V, GND, GND, VIN, A1,A2,A3,A4,A5
Which pin performs which function when the shield is connected to the Arduino.
Commands You Can Use While Using the LCD Screen
Command | Feature |
lcd.clear() | Clears the screen. |
lcd.print(data) | Writes text to the screen |
lcd.setCursor(x,y) | Allows you to begin writing at the X and Y rows. |
lcd.scrollDisplayLeft() | Scrolls the display to the left |
lcd.scrollDisplayRight() | Scrolls the display to the right |
lcd.creatChar(num,data) | Used to create special characters. |
How is the Screen on the Shield Used?
#include <LiquidCrystal.h>
// Screen
LiquidCrystal Ekran(8, 9, 4, 5, 6, 7);
// Basic Functions
void setup() {
Serial.begin(9600);
BTSerial.begin(38400);
Ekran.begin(16, 2);
Ekran.setCursor(0,0);
Ekran.print("UrhobA");
Ekran.setCursor(0,1);
Ekran.print("2. Line");
}
void loop() {
}#include <LiquidCrystal.h>
// Screen
LiquidCrystal Ekran(8, 9, 4, 5, 6, 7);
int basilanTus = 0;
int okunanDeger = 0;
#define rightButton 0;
#define leftButton 1;
#define upButton 2;
#define downButton 3;
#define selectButton 4;
#define noneButton 5;
// Special Functions
byte ButtonFind() {
okunanDeger = analogRead(A0);
if (okunanDeger > 1000) {
return noneButton;
}
if (okunanDeger < 50) {
return rightButton;
}
if (okunanDeger < 195) {
return upButton;
}
if (okunanDeger < 380) {
return downButton;
}
if (okunanDeger < 555) {
return leftButton;
}
if (okunanDeger < 790) {
return selectButton;
}
}
void ClearScreen(int x, int y) {
Ekran.setCursor(x, y);
Ekran.print(" ");
}
void PrintScreen(int x, int y, String text) {
Ekran.setCursor(x, y);
Ekran.print(text);
}
// Basic Functions
void setup() {
Serial.begin(9600);
BTSerial.begin(38400);
Ekran.begin(16, 2);
PrintScreen(0, 0, " UrhobA ");
PrintScreen(0, 1, "System Starting..");
delay(1000);
ClearScreen(0, 1);
PrintScreen(0, 1, "System Started");
delay(1000);
Ekran.setCursor(0, 1);
ClearScreen(0, 1);
}
void loop() {
basilanTus = ButtonFind();
Ekran.setCursor(0, 1);
}







Yorum Gönder