This chapter discusses the following functions of the LiquidCrystal library:

  • LiquidCrystal()
  • begin()
  • print()
  • write()
  • clear()
  • home()
  • setCursor()
  • cursor()
  • noCursor()
  • blink()
  • noBlink()
  • rightToLeft()
  • leftToRight()
  • scrollDisplayLeft()
  • scrollDisplayRight()
  • autoscroll()
  • noAutoscroll()
  • createChar()

The hardware needed to use the examples in this chapter includes:

  • Arduino Mega 2560
  • SainSmart LCD Shield
  • HC-SR04 ultrasonic distance sensor

You can find the code download for this chapter at on the Download Code tab. The code is in the Chapter 11 download folder and is named Chapter 11.ino.


For computers to be effective, they require two things: a way to input data and a way to output data. Data output can be in several forms; sometimes, it is invisible, communicating with other devices, such as safety systems in transportation. They are busy keeping you safe, but you will never see them. Other forms are slightly more visible: devices designed to turn on other devices, such as a timer designed to turn on a coffee machine at a particular time. They have the capacity to interact with the outside world but can be difficult to see.

Of all the human senses, sight is probably the most powerful. The best way for a computer to communicate data to the user is visually. Lights are often used for small quantities of data; a small light on your television set can tell you if it is receiving information from a remote control, ...

Get Arduino Sketches: Tools and Techniques for Programming Wizardry now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.