Source Code

The following sets of code below were used to conduct Team C’s tests:

Scenario Code

 celerate(1,0,25,3);

Motor 1 on from 0% to 25% in 3 seconds.
reverse(2); Reverse motor 2.
celerate(2,0,25,3); Motor 2 on from 0% to 25% in 3 seconds.
motorSpeed(4,25); All motors set at power 25%.
goFor(1); Continue for 1 second.
motorSpeed(4,20); All motors set at power 20%.
goFor(2); Continue for 2 seconds.
reverse(4); Reverse all motors.
motorSpeed(4,25);  All motors set at power 25%.
goFor(2); Continue for 2 seconds.
brake(4); Stop all motors.

 Programming Basics Code

Click Here 

Power Braking Code

reverse(4); Switches motor direction.
celerate(4,0,35,2); All motors power on from 0% to 35% in 2 seconds.
motorSpeed(4,35); All motors set at power 35%.
goToAbsolutePosition(255); Go to a certain spot on track.
brake(4); Stop all motors.
goToAbsolutePosition(300); AEV coasting to certain spot.
reverse(4); Once it reaches above spot, switch motor direction.
motorSpeed(4,35); All motors set at power 35%.
goFor(.35); Power brake for .35 seconds.
brake(4); Stop all motors.
goFor(7); AEV stops and pauses for 7 seconds.
reverse(4); Switch motor direction.
celerate(4,0,30,2); All motors power on from 0% to 30% in 2 seconds.
motorSpeed(4,30); All motors set at power 30%.
goFor(3.5); All motors on 30% for 3.5 seconds.
brake(4); Stop all motors.

 

 

Coasting Code

reverse(4); Switch motor direction.
celerate(4,0,35,2); All motors power on from 0% to 35% in 2 seconds.
motorSpeed(4,35); All motors set at power 35%.
goToAbsolutePosition(250); Go to a certain spot on track.
brake(4); Stop all motors.
goToAbsolutePosition(320); Coast to certain spot on track.
goFor(7); AEV stops and pauses for 7 seconds.
celerate(4,0,30,2); All motors power on from 0% to 30% in 2 seconds.
motorSpeed(4,30); All motors set at power 30%.
goFor(3.5); All motors on 30% for 3.5 seconds.
brake(4); Stop all motors.