Iowa State University

CPRE 288 Laboratory

Lab 9: Object Counting and Size Discrimination

Lecture - Lab Connection

In this lab, you will integrate the Ping sensor (Lab 7), IR distance sensor (Lab 6), and servo motor (Lab 8) in order to detect and count objects and determine their size. You will also use WiFi to transmit your results back to Putty (Lab 5).

Pre Lab

  • Read through this lab description.
  • Review your code from previous labs. Improve code comments if needed for readability and reuse. Review your results from previous labs. Identify functionality that may need to be improved.
  • Sketch your hardware-software system. Identify software modules, what is available from previous labs to be reused, and what will be created for this lab.
  • The work done for this lab will be directly applicable to the final project. While you will not be working as Porject Teams teams for Lab 9, you may want to begin interacting together and reviewing each others code.
  • There are no prelab questions.
  • Print the Lab Evaluation Form, so that your TA can check off work performed during this lab session.

Reference Files

Download the following files to a single folder on your U: drive (right-click and select 'Save Target As'. Alternatively, download the zipped folder at the bottom of the page).

  • timer.c/timer.h: The file that contains the utility functions for the cyBOT platform.
  • lcd.c/lcd.h: The program file with a number of LCD functions.
Verify that you are using a version of lcd.c in which the lcd_init function preserves the contents of registers that it is initializing. There have been a couple of incidences of an older version of this file being used that overwrites other bit values. Then, if a program called this function after other initialization functions, it would overwrite other initializations.

Lab 9 Description

  • Lab 9 Manual: A detailed description of the objectives to complete for Lab 9


Turn the power to the Cerebot board and iRobot off before charging. The Cerebot board consumes power and the battery will not charge if the robot is in full_mode (which it enters after calling oi_init, turing the power LED yellow). The robot is charging when the robot's power LED is pulsing red and both green LEDS on the dock are lit.

Reference Files

Files Description
Tiva TM4C123GH6P datasheet.pdf Information about the TM4C123GH6P
Lab Evaluation Form Evaluation form for Lab