microrobotics

Untitled

Oct 18th, 2021
849
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // LiquidCrystal_I2C.h: https://github.com/johnrickman/LiquidCrystal_I2C
  2. #include <Wire.h> // Library for I2C communication
  3. #include <LiquidCrystal_I2C.h> // Library for LCD
  4. // Wiring: SDA pin is connected to A4 and SCL pin to A5.
  5. // Connect to LCD via I2C, default address 0x27 (A0-A2 not jumpered)
  6. LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 16, 2); // Change to (0x27,20,4) for 20x4 LCD.
  7. void setup() {
  8.   // Initiate the LCD:
  9.   lcd.init();
  10.   lcd.backlight();
  11. }
  12. void loop() {
  13.   // Print 'Hello World!' on the first line of the LCD:
  14.   lcd.setCursor(2, 0); // Set the cursor on the third column and first row.
  15.   lcd.print("Hello World!"); // Print the string "Hello World!"
  16.   lcd.setCursor(2, 1); //Set the cursor on the third column and the second row (counting starts at 0!).
  17.   lcd.print("LCD tutorial");
  18. }
RAW Paste Data