Lab 6 Code

Two programs were created. The first code mostly used the celerate command while the second mostly used the motorSpeed command.

  • Program #1

reverse(4);//All motors will be reversed

celerate(4,0,39,1);// All motors will accelerate from 0% power to 39%power in 1 second

goFor(5);// Run the previous command for 5 seconds

brake(4);//All motors will be stopped

reverse(4);//All motors will be put in reverse

celerate(4,0,15,1);// All motors will accelerate from 0% power to 15% power for 1 second

goFor(1);// Run the previous command for 1 second

brake(4);//All motors will brake

goFor(1);// Run the previous command for 1 second

celerate(4,0,20,1);//All motors will accelerate from 0% power to 20% power in 1 second

goFor(7);// Run the previous command for 7 seconds

reverse(4);//All motors will be reversed

celerate(4,0,27,2);// All motors will accelerate from 0% power to 27% power in 2 seconds

brake(4);// All motors will brake

goFor(1);// Run the previous command for 1 second

reverse(4);//All motors will be reversed

celerate(4,0,34,3);//All motors will accelerate from 0% power to 34% power in 3 seconds

goFor(2);// Run the previous command for 2 seconds

reverse(4);//All motors will be reversed

celerate(4,0,22,1);//All motors will accelerate from 0% power to 22% power

brake(4);//All motors will brake

goFor(1);//Run the previous command for 1 second

 

  • Program #2

reverse(4); //All the motors are reversed

motorSpeed(4,42); //All motors are brought to 42% power

goToRelativePosition(-155); //The AEV moves to about 8 feet backwards

reverse(4);//All the motors are reversed

motorSpeed(4,23);//All motors are brought to 23% power

goFor(2);//Run the previous command for 2 seconds

brake(4);//All motors turn off

goFor(2);//Run the previous command for 2 seconds

motorSpeed(4,25);//All motors are brought to 25% power

goToRelativePosition(400);//The AEV will move about 24 feet

reverse(4);//All motors are reversed

motorSpeed(4,23);//All motors are brought to 23% power

goFor(2);//Run the previous command for 2 seconds

brake(4);//All motors will stop

goFor(2);//Run the previous command for 2 seconds

reverse(4);//All motors are reversed

motorSpeed(4,30);//All motors are brought to 30% power

goToRelativePosition(160);//The AEV will move 8 feet

reverse(4);//All motors will be reversed

motorSpeed(4,23);//All motors will be brought to 23% power

goFor(2);//Run the previous command for 2 seconds

brake(4);//All motors will stop