CS325  Lab 2 - Using a sensor

Objectives:

  1. Download lab2.r3 and read through the code.  This is an incomplete program which will use an optical sensor to find the center of a circle and then trace around the outside of the circle.
     
  2. The sensor will be at input(1) and you can test the values at input(1) to see if they are 0 (black) and 1 (white).
     
  3. To find the center point you should move the x and y values of the arm (leaving the z value at around 60) until you find the white circle.
    Once you are within the white circle, move just the x value up until you find the edge, and then down until you find the edge.  Calculate the midpoint and you have a chord in the circle.  At the midpoint, move the y values left and right until you find the edges, and calculate the midpoint again.  This will be the center.
     
  4. After the centerx and centery are known, the code traces around the outside of the circle by storing points and following a path through those points.
     
  5. Demo your program for me and email your code to jill.zimmerman@goucher.edu