Lesson Plan: Week 7
In Week 7 we will do the following (please, click on the Segment links below to access the course materials):
Homework 6: Use the proximity sensor to determine the distance to an object and then show the measured distance on the LCD display
Goal: Understand how to use the proximity sensor and the LCD display with the Arduino. Learn to use C++ libraries to control complex electronic components such as the LCD display. This homework leads up to Deliverable 3 where the proximity sensor is to be operated with a C++ library that needs to be written.
Set-up: Connect the proximity sensor and the LCD display to the Arduino.
Programming: Program the Arduino that it continuously reads out the proximity sensor. The read out sensor value needs to be converted to cm and inches and then displayed on the LCD display. The first line of the display needs to show the distance in cm and the second line needs to show the corresponding value in inches. The display needs to be updated frequently to show an up to date value.
Proximity sensor: Watch our proximity sensor video posted here. It explains how it works, how to use it and an example sketch is also provided.
LCD display: Watch our video about the LCD display. It discusses how to use the display via the "I2C bus", which is an industry standard for communication between integrated circuits. The above page also has a link for down loading the appropriate C++ library for the LCD display.
Using C++ libraries: Libraries are based on C++ functions. Start out by watching our video about functions. Then watch the video about object oriented programming, and then go on to our making C++ libraries video. You will need to know all these topics for Deliverable 3, where you will write your own C++ library. It is important to understand where to save the libraries within the Arduino folder, and also that you need to restart the Arduino IDE before you can use an added library.
To get credit: Come to class on the due date and present your working set-up to one of the TAs or Instructors.