Advertisement
microrobotics

Arduino interface LCD 16x2 Character Display HD44780

May 11th, 2023 (edited)
1,094
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. To interface a 16x2 LCD with Arduino, you can use the LiquidCrystal library. Here's a simple example:
  3.  
  4. RS => Arduino Pin 7
  5. EN => Arduino Pin 8
  6. D4 => Arduino Pin 9
  7. D5 => Arduino Pin 10
  8. D6 => Arduino Pin 11
  9. D7 => Arduino Pin 12
  10. */
  11.  
  12. #include <LiquidCrystal.h>
  13.  
  14. // Initialize the LCD and specify the GPIO pins
  15. LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
  16.  
  17. void setup() {
  18.   // Set up the LCD's number of columns and rows:
  19.   lcd.begin(16, 2);
  20.  
  21.   // Print a message to the LCD
  22.   lcd.setCursor(0, 0);
  23.   lcd.print("Hello, world!");
  24.   lcd.setCursor(0, 1);
  25.   lcd.print("Arduino");
  26. }
  27.  
  28. void loop() {
  29.   // No need to repeat anything in the loop for this simple example
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement