How to connect Arduino uno to LCD 16x2 display very simple

"Hello World!"

The LiquidCrystal library enables you to control LCD shows that are good with the Hitachi HD44780 driver. There are huge numbers of them out there, and you can more often than not let them know by the 16-stick interface.
This model sketch prints "Hi World!" to the LCD and demonstrates the time in seconds since the Arduino was reset.


  output of the sketch on a 16x2 LCD

The LCDs have a parallel interface, implying that the microcontroller needs to control a few interface sticks without a moment's delay to control the showcase. The interface comprises of the accompanying pins:

Hardware Required

  • Arduino or Genuino Board
  • LCD Screen (compatible with Hitachi HD44780 driver)
  • pin headers to solder to the LCD display pins
  • hook-up wires
  • breadboard

Code

 //include the library code:
  #include <LiquidCrystal.h>

  // initialize the library by associating any needed LCD interface pin
  // with the arduino pin number it is connected to
  const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
  LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

  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);
  }
  

1 comment:

Powered by Blogger.