EXERCISE 1: PROGRAMMING BASICS

Exercise 1:

celerate(1,0,15,2.5); //accelerates motor 1 0-15% in 2.5 seconds

goFor(1);             //holds the final speed for 1 second

brake(1);             //stops motor 1

celerate(2,0,27,4);   //accelerates motor 2 0-27% in 4 seconds

celerate(2,27,15,1);  //decellerates otor 2 to 15% in 1 second

brake(2);             //stops motor 2

reverse(2);           //makes motor 2 reverse, all positive values will make it move back

celerate(4,0,31,2);   //accelerates motor 1 forward to 31% in 2 seconds and motor backwards to 31% in 2 seconds

motorSpeed(4,35);     //presets the motor to 35%

goFor(1);             //holds this 35% speed for 1 second

brake(2);             //brakes motor 2, motor 1 is still running forward at 35%…

goFor(3);             //…for three seconds

brake(4);

goFor(1);             //these lines brake all motors for 1 seconds

reverse(1);           //currently motor 1 and 2 are reversed

celerate(1,0,19,2);   //accelerates motor 1 0-19% in 2 seconds

motorSpeed(2,35);     //sets the motor speed for motor 2 to 35%

goFor(2);             //waits for 2 seconds. motor 1 is at 19% and motor 2 is at 35%

motorSpeed(2,19);     //both motors are now 19%

goFor(2);             //runs both motors at 19% for 2 seconds

celerate(4,19,0,3);   //decellerates all motors to 0 from 19%

brake(4);             //stops all motors

 

The purpose of Lab Activity One was to download AEV_Controller Program to better understand the basics of coding the vehicle through the OSU function library. In this lab, Division C learned how to accelerate motors at a certain power for a extended period of time, as shown in the code above. They also mastered how to brake both motors and have motors running at different speeds. How the motors reacted with different speeds was tested so the team better understood how much power was needed for when the motors are running on the track. It was difficult to figure out which ports and processors to use while using the proper notation in the code. Setting up the Sketchbook was particularly difficult and the team discussed some of the problems and solutions they found at the end of the lab. The code below was developed during the lab.

 

MCR Referenced in this exercise