First Code-Programming Basics
// Program between here——————————————————————-
//Accelerate motor 1 from start to 15% in 2.5 sec
celerate(1,0,15,2.5);
// Run motor one at a constant speed (15% power) for 1 second.
motorSpeed(1,15); goFor(1);
// Brake motor one.
brake(1);
//Accelerate motor two from start to 27% power in in 4 sec
celerate(2,0,27,4);
//Keep constant for 2.7 seconds
goFor(2.7);
//Decelerate motor 2 to 15% power in 1 sec
celerate(2,27,15,1);
//brake motor 2
brake(2);
//reverse motor 2
reverse(2);
//accerlate all motors from start to 31% power in 2 secs
celerate(4,0,31,2);
//run all motors at a constant speed of 35% for 1 sec
motorSpeed(4,35); goFor(1);
//brake motor 2 but keep motor one running at a constant speed- 35% for 3 sec
brake(2);
motorSpeed(1,35); goFor(3);
//brake all motors for one sec
brake(4); goFor(1);
//reverse direction of motor one
reverse(1);
//accerlerate motor one from start to 19% over 2 sec
celerate(1,0,19,2);
//run motor two at 35% power, run motor one at 19% power for 2 sec.
motorSpeed(2,35); motorSpeed(1,19); goFor(2);
//run both motors at constant 19% for 2 sec
motorSpeed(4,19); goFor(2);
//decelerate both motors 0% power in 3 seconds
celerate(4,19,0,3);
//brake all motors
brake(4);
Second Code- Reflective Sensors
//run all motors at 25% for 2 sec
motorSpeed(4,25); goFor(2);
//run all motors at a constant speed 20 use absolute position to go 12 feet
motorSpeed(4,20);
goToAbsolutePosition(296);
//reverse motor
reverse(4);
//run all motors at 30 for 1.5 sec
motorSpeed(4,30); goFor(1.5);
//brake all motors
brake(4);
Third Code – Data Analysis
celerate(4,0,30,3);
//run all motors at 25% for 1 sec
motorSpeed(4,25); goFor(1);
//run all motor for 20% for 2 sec
motorSpeed(4,20); goFor(2);
//reverse all motors
reverse(4);
//run all motor at 25% for 2 sec
motorSpeed(4,25); goFor(2);
//brake all motors
brake(4);
Fourth Code-Coasting
//go 100 mark, at 30 speed
motorSpeed(4,30);
goToRelativePosition(-100);
//brake motors
brake(4);
Fifth Code-Power Braking
//go 100 mark, at 35 speed
motorSpeed(4,30); goToRelativePosition(-100);
//brake motors
brake(4);
// reverse motors
reverse(4); motorSpeed(4,45); goFor(1);
Sixth Code-Energy Analysis
motorSpeed(4,30); goFor(4);
motorSpeed(4,0); goFor(10);
Seventh Code-1st Performance Test
//both motors speed 30% and to 15 feet
reverse(4);//forward
motorSpeed(4,35);
goToRelativePosition(186.4);//full power-155
// brake both motors
motorSpeed(4,0);
goFor(.7);
//power brake
reverse(4);//reverse
motorSpeed(4,55.5);
goFor(1.2);
//wait for 6 sec
motorSpeed(4,0);
goFor(7.5);
//go past gate
reverse(4); //forward
motorSpeed(4,35);
Eighth Code-2nd Performance Test
//both motors speed 30% and to 15 feet
reverse(4);//forward
motorSpeed(4,35);
goToRelativePosition(186.4);//full power-155
// brake both motors
motorSpeed(4,0);
goFor(.7);
//power brake
reverse(4);//reverse
motorSpeed(4,55.5);
goFor(1.2);
//wait for 6 sec
motorSpeed(4,0);
goFor(7.5);
//go past gate
reverse(4); //forward
motorSpeed(4,35);
goToRelativePosition(58);
//coast
motorSpeed(4,0);
goToRelativePosition(258);
//power-brake
reverse(4);//backward
motorSpeed(4,37.5);
goFor(.7);
motorSpeed(4,0); goFor(5);
//go back to gate.5
//forward-use negative marks
motorSpeed(4,52.5);
goToRelativePosition(-238);
Ninth Code-Final Performance Test
// Program between here——————————————————————-
//both motors speed 30% and to 15 feet
reverse(4);//forward
motorSpeed(4,35);
goToRelativePosition(186.4);//full power-155
// brake both motors
motorSpeed(4,0);
goFor(.7);
//power brake
reverse(4);//reverse
motorSpeed(4,55.5);
goFor(1.2);
//wait for 6 sec
motorSpeed(4,0);
goFor(7.5);
//go past gate
reverse(4); //forward
motorSpeed(4,35);
goToRelativePosition(58);
//coast
motorSpeed(4,0);
goToRelativePosition(258);
//power-brake
reverse(4);//backward
motorSpeed(4,37.5);
goFor(.7);
motorSpeed(4,0); goFor(5);
//go back to gate.5
//forward-use negative marks
motorSpeed(4,52.5);
goToRelativePosition(-238);
//power-brake
reverse(4);
motorSpeed(4,60);
goFor(1.0);
//wait
motorSpeed(4,0);
goFor(8.5);
//go past gate
reverse(4);
motorSpeed(4,55);
goToRelativePosition(-135);
motorSpeed(4,0);
//coast
goToRelativePosition(-170);
//power-brake/finish
reverse(4);
motorSpeed(4,60);
goFor(1.0);