Skip to Content
Hands-On Robotics Programming with C++
book

Hands-On Robotics Programming with C++

by Dinesh Tavasalkar
March 2019
Intermediate to advanced
312 pages
7h 37m
English
Packt Publishing
Content preview from Hands-On Robotics Programming with C++

The LCD and the ultrasonic sensor program

After printing a simple text value on the LCD, let's take a look at how to view the ultrasonic distance value on the LCD screen. The wiring connection of the HC-SR04 ultrasonic sensor, the 16x2 LCD, and the RPi are as follows:

The LCD connections to the RPi remain the same. The ultrasonic trigger pin is connected to wiringPi pin number 12 and the echo pin is connected to wiringPi pin number 13. Let's now take a look at the program. This program is called LCDdm.cpp (dm is short for distance measurement) and you can download it from the GitHub repository of Chapter04. The LCDdm.cpp program is a combination ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learn Robotics Programming

Learn Robotics Programming

Danny Staple
C++ Reactive Programming

C++ Reactive Programming

Praseed Pai, Peter Abraham

Publisher Resources

ISBN: 9781789139006Supplemental Content