Display.ino 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. LiquidCrystal Library - display() and noDisplay()
  3. Demonstrates the use a 16x2 LCD display. The LiquidCrystal
  4. library works with all LCD displays that are compatible with the
  5. Hitachi HD44780 driver. There are many of them out there, and you
  6. can usually tell them by the 16-pin interface.
  7. This sketch prints "Hello World!" to the LCD and uses the
  8. display() and noDisplay() functions to turn on and off
  9. the display.
  10. The circuit:
  11. * LCD RS pin to digital pin 12
  12. * LCD Enable pin to digital pin 11
  13. * LCD D4 pin to digital pin 5
  14. * LCD D5 pin to digital pin 4
  15. * LCD D6 pin to digital pin 3
  16. * LCD D7 pin to digital pin 2
  17. * LCD R/W pin to ground
  18. * 10K resistor:
  19. * ends to +5V and ground
  20. * wiper to LCD VO pin (pin 3)
  21. Library originally added 18 Apr 2008
  22. by David A. Mellis
  23. library modified 5 Jul 2009
  24. by Limor Fried (http://www.ladyada.net)
  25. example added 9 Jul 2009
  26. by Tom Igoe
  27. modified 22 Nov 2010
  28. by Tom Igoe
  29. modified 7 Nov 2016
  30. by Arturo Guadalupi
  31. This example code is in the public domain.
  32. http://www.arduino.cc/en/Tutorial/LiquidCrystalDisplay
  33. */
  34. // include the library code:
  35. #include <LiquidCrystal.h>
  36. // initialize the library by associating any needed LCD interface pin
  37. // with the arduino pin number it is connected to
  38. const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
  39. LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
  40. void setup() {
  41. // set up the LCD's number of columns and rows:
  42. lcd.begin(16, 2);
  43. // Print a message to the LCD.
  44. lcd.print("hello, world!");
  45. }
  46. void loop() {
  47. // Turn off the display:
  48. lcd.noDisplay();
  49. delay(500);
  50. // Turn on the display:
  51. lcd.display();
  52. delay(500);
  53. }