Assignment 5 - RobotC Intro to Arrays
This program asks you to seek out information on RobotC functions (the equivalent of Java methods) and use them to solve problems. The further you get in the assignment, the higher mark you will receive. Your programs should adjust the motor power settings to make the drive as straight as possible. However, you are allowed to manually straighten your robots to avoid drifting.
Information about RobotC arrays and for loops and other coding can be found here: http://robodesigners.blogspot.ca/2012/04/arrays-in-robotc.html
Create a new file called Assign5_Arrays.c.
Begin by copying your turn(degrees) and drive(feet) functions from the last assignment.
Part 1 - Straight Drive 80%
Create an array called distances that holds the following numbers: 2, 1, 3, 2, 3, 2
Set up a for loop that will read from the array.
Inside the for loop:
Spin for 2 seconds when the for loop is finished.
Demonstrate to your teacher when done.
Part 2 - Add an If Statement 20%
Inside the for loop, add an if statement to ignore any distances greater than two. INSTEAD, spin 180 degrees.
In other words, you program should
Demonstrate to your teacher when done.