30 lines
929 B
Arduino
30 lines
929 B
Arduino
|
|
// Include the Wire.h library. This is the I2C library
|
||
|
|
#include <Wire.h>
|
||
|
|
// Include the LiquidCrystal_I2C library. This is the library allowing us to communicate with the screen using I2C
|
||
|
|
#include <LiquidCrystal_I2C.h>
|
||
|
|
|
||
|
|
// Create a new variable of the LCD type and insert the appropriate values
|
||
|
|
// The type takes the following values:
|
||
|
|
// 1. The I2C address of the LCD (0x20 to 0x27)
|
||
|
|
// 2. The amount of character columns
|
||
|
|
// 3. The amount of character rows
|
||
|
|
LiquidCrystal_I2C lcd(0x27, 16, 2);
|
||
|
|
|
||
|
|
void setup(){
|
||
|
|
// Initialize the connection to the display
|
||
|
|
lcd.init();
|
||
|
|
// Turn the display backlight on
|
||
|
|
lcd.backlight();
|
||
|
|
// Set the cursor to the first character on the first row
|
||
|
|
lcd.setCursor(0,0);
|
||
|
|
// Print "Hello," to the display
|
||
|
|
lcd.print("Hello,");
|
||
|
|
// Set the cursor to the first character on the second row
|
||
|
|
lcd.setCursor(0,1);
|
||
|
|
// Print "World!" to the display
|
||
|
|
lcd.print("World!");
|
||
|
|
}
|
||
|
|
|
||
|
|
void loop(){
|
||
|
|
}
|