The schematic below shows how to wire a 16x2 LCD display with an Arduino board. We can use any LCD display that is compatible with the Hitachi HD44780 driver. Besides the Arduino board and LCD panel, we will also need a 10K potentiometer to adjust the contrast of the characters on the LCD screen.
Part List:
The Code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup(){
lcd.begin(16, 2);
lcd.print("Elapsed Time:");
}
void loop(){
// Counting begins from 0
// (0,1) means 1st character of 2nd line
lcd.setCursor(0, 1);
lcd.print(millis()/1000);
lcd.print(" sec");
}
Part List:
- Arduino Board
- 16x2 character LCD display
- 10K potentiometer
The Code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup(){
lcd.begin(16, 2);
lcd.print("Elapsed Time:");
}
void loop(){
// Counting begins from 0
// (0,1) means 1st character of 2nd line
lcd.setCursor(0, 1);
lcd.print(millis()/1000);
lcd.print(" sec");
}
No comments:
Post a Comment