Published using Google Docs
Assign 9 - Advanced: Using an Alternate Sensor
Updated automatically every 5 minutes

Not for 2016

Assignment 9 - Advanced: Using an Alternate Sensor

This assignment is only for those students interested in earning better than 80% in the credit.  If you are not on pace, you should skip it and come back to it later.

Important Notes:

Choose Your Sensor (or it may be assigned to you)

There are 4 sensor options to choose but in some cases we only have one of each type:

Set up and Build Phase

If you have not already done so, attach your sensors to your robot.  

Create a new file called Assign7_AlternateSensors.c.  


Option 1: Shaft Encoders (rotation sensor)

Part 1: Using the debug window

Note: You MUST always reset a shaft encoder at the beginning of your program.  See the sample code on the T: drive for an example.

Remember your grade 7 geometry?  The circumference of a tire is Pi*Diameter.  This is important.

Reset your sensor to zero and then use the debug window to determine what the sensor reads for exactly one full rotation.

Then, in a comment above your main task, answer the following questions:

        //One full FORWARD rotation  (starting at zero)results in a shaft encoder reading of: ___

        //One full Backward rotation (starting at zero) results in a shaft encoder reading of: ___

        //The diameter of my tire is: _____ cm.  

        //Using my grade 7 geometry, my robot moves ____ cm on one full rotation.

Part 2: Drive for exactly 1 meter

Your job is to write a program that lets the robot drive for exactly 1 meter using the SHAFT ENCODER to tell the distance.  You will get ZERO marks if you use a timer.  

How?

Part 3: Drive Turn Drive

Drive for exactly 1 meter (or as close as you can get it using the shaft encoder)

Turn right using past code

Drive for exactly 2 meters

Turn right

Drive for exactly 3 meters

Do a spin-a-rama or dance for 5 seconds

To test your code, place it on the silver square by the main door of the classroom and have it face the wall with the soap dispenser on it.  The robot should head out the door, turn on approximately the red line, drive for 3 meters and then dance.

Option 2: Line Follower Kit