In this blog, we will be discussing interfacing 16x2 LCD Screen with Arduino Uno.
# Data Sheet:
Working Voltage: 5V
Working Current: 5-30 mA
Duty Cycle: 1/16
# Pin-Out:
Gnd ... Power Supply Pin
Vcc = 5V ... Power Supply Pin
Contrast Pin: For adjusting the contrast of fonts
(Generally, a potentiometer is used for adjusting contrast)
RS Pin: connected to Arduino digital pin
RW Pin: Write = 0 and Read = 1
Enable Pin: Recieve the pulse from Echo Pin (Input Pin)
Data Pins: D0-D7
Note: We will be using D4-D7 only.
Backlight Vcc: For backside yellow light
Backlight Ground: For backside yellow light
# Arduino Connection:
# Working:
The working is simple.
First, you need to set the cursor in the LCD screen, from where you need to display the data.
Then send the data to display.
By default, the cursor will be set to (0,0) position.
Syntax...(column, row)
# Arduino Code:
// include the library code:
#include <LiquidCrystal.h>
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
// define the lcd that you are using
//here we are using 16x2 lcd
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}
void loop() {
// set the cursor to column 0, line 1
// lcd.setCursor(column_no.,row_no.)
//millis()...is the built in function that gives u the number of seconds since reset
lcd.setCursor(0,1);
lcd.print(millis() / 1000);
}
1. To Display the sensor data
2. To select the options manually (in robots)
To download the code click here
Nice ☝
ReplyDeleteAwesome
ReplyDelete