This circuit integrates an Arduino UNO microcontroller with a 16x2 LCD display and a pushbutton. The Arduino UNO is used as the central processing unit, controlling the display output on the LCD and reading the input from the pushbutton. The LCD is used to display text messages and the pushbutton serves as a user input device. The circuit is powered by the Arduino UNO's 5V output, which is connected to the LCD, and the ground connections are shared among the components.
/*
RS -> D7
E -> D8
D4 -> D9
D5 -> D10
D6 -> D11
D7 -> D12
*/
// Include the LiquidCrystal library
#include <LiquidCrystal.h>
// Initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
void setup() {
// Set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("Hello, World!");
}
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);
}
This code initializes the 16x2 LCD and prints "Hello, World!" on the first line. On the second line, it continuously updates and displays the number of seconds since the Arduino UNO was last reset. The LCD interface pins are connected to the digital pins D7 to D12 on the Arduino UNO.