This circuit is designed to establish I2C communication between an Arduino UNO microcontroller and a 16x2 LCD screen. The LCD is interfaced with the Arduino using the I2C protocol, which minimizes the number of pins required for communication, using only two data lines (SCL and SDA). The Arduino is programmed to initialize the I2C communication, control the LCD, and display a message on it. The circuit is powered by the 5V output from the Arduino, which is also connected to the VCC pin of the LCD to provide the necessary operating voltage.
/*
* This Arduino Sketch initializes I2C communication and displays a message
* on a 16x2 LCD screen connected via I2C.
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
// Initialize I2C communication
Wire.begin();
// Initialize the LCD
lcd.begin();
// Turn on the backlight
lcd.backlight();
// Print a message to the LCD
lcd.setCursor(0, 0);
lcd.print("Hello, World!");
}
void loop() {
// Main loop does nothing
}
Filename: sketch.ino
Description: The code initializes the I2C communication with the LCD screen and displays the message "Hello, World!" on the first line of the screen. The setup()
function is called once when the program starts and is used to initialize settings. The loop()
function runs continuously after setup()
finishes and is left empty in this case.