1st Code-Programing Basics Lab
//accelerated motor 1 from 0 to 25% for 2.5 seconds
celerate(1,0,15,2.5);
//Sets motor 1 to 15% power
motorSpeed(1,15);
//Runs the previous line for one second
goFor(1);
//brakes motor one
brake(1);
//accelerates motor 2 from 0 to 27% for four seconds
celerate(2,0,27,4);
//sets motor 2 at 27% power
motorSpeed(2,27);
//runs the previous line for 2.7 seconds
goFor(2.7);
//accelerates motor two from 27 to 15% over one second
celerate(2,27,15,1);
//brakes motor 2
brake(2);
//accelerates all motors from 0 to 31% over two seconds
celerate(4,0,31,2);
//sets all motors to 35% power
motorSpeed(4,35);
//has the previous line run for 1 second
goFor(1);
//brakes motor 2
brake(2);
//sets motor 1 at 35% power
motorSpeed(1,35);
//runs the previous line for 3 seconds
goFor(3);
//breaks all motors
brake(4);
//runs the previous line for 1 second
goFor(1);
//reverses motor 1
reverse(1);
//sets motor 1 to 19% power
motorSpeed(1,19);
//runs the previous line for one second
goFor(2);
//sets motor 2 at 35% power
motorSpeed(2,35);
//runs the previous line for 2 seconds
goFor(2);
//sets all motors at 19% power
motorSpeed(4,19);
//runs the previous line for 2 seconds
goFor(2);
//accelerates all motors from 19 to 0 for 3 seconds
celerate(4,19,0,3);
//brakes all motors
brake(4);
2nd Code- Reflective Sensory Test
// Reflectance Sensor Test
reflectanceSensorTest();
// Run motor one at a constant speed (25% power) for 2 seconds
motorSpeed(4,25);
goFor(2);
brake(4);
// Run all motors at 20% power
motorSpeed(4,20);
goToAbsolutePosition(70.2);
// Reverse motors
reverse(4);
// Run motors at 30% for 1.5 seconds
motorSpeed(4,30);
goFor(1.5);
// Brake all motors
brake(4);
3rd Code- Data Analysis Tool Lab
// reverses all motors
reverse(4);
//accelerates all motors from 0 to 25 over 3 seconds
celerate(4,0,25,3);
//sets all motors to 25% power
motorSpeed(4,25);
//runs previous line for 1 second
goFor(1);
//sets all motors to 20% power
motorSpeed(4,20);
//runs the previous line for 2 seconds
goFor(2);
//reverses all motors
reverse(4);
//sets all motors at 25% power
motorSpeed(4,25);
//runs previous line for 2 seconds
goFor(2);
//brakes all motors
brake(4);
4th Code- Motor Configuration:
// reverses all motors
reverse(4);
//accelerates all motors from 0 to 25 over 3 seconds
celerate(4,0,25,3);
//sets all motors to 25% power
motorSpeed(4,25);
//runs previous line for 1 second
goFor(1);
//sets all motors to 20% power
motorSpeed(4,20);
//runs the previous line for 2 seconds
goFor(2);
//reverses all motors
reverse(4);
//sets all motors at 25% power
motorSpeed(4,25);
//runs previous line for 2 seconds
goFor(2);
//brakes all motors
brake(4);
5th Code- Propellor Configuration:
// reverses all motors
reverse(4);
//accelerates all motors from 0 to 25 over 3 seconds
celerate(4,0,25,3);
//sets all motors to 25% power
motorSpeed(4,25);
//runs previous line for 1 second
goFor(1);
//sets all motors to 20% power
motorSpeed(4,20);
//runs the previous line for 2 seconds
goFor(2);
//reverses all motors
reverse(4);
//sets all motors at 25% power
motorSpeed(4,25);
//runs previous line for 2 seconds
goFor(2);
//brakes all motors
brake(4);
6th Code- Performance Test 1:
//Accelerates both motors from 0 to 30% power over 3 seconds
celerate(4,0,30,3);
//sets both motors to 30% power
motorSpeed(4,30);
//previous task goes until the AEV hits 247 marks
goToAbsolutePosition(247);
//brakes all motors
brake(4);
//previous task goes until AEV hits 283 marks
goToAbsolutePosition(283);
//rotates the servo to 40 degrees
rotateServo(40);
//previous task goes for 6 seconds
goFor(6);
//rotates the servo to 0 degrees
rotateServo(0);
//previous task goes for 1 seconds
goFor(1);
//sets motor 1 to 25% power
motorSpeed(1,25);
//sets motor 2 to 25% power
motorSpeed(2,25);
//previous task goes for 5 seconds
goFor(5);
7th Code-Code 1 for Performance Test 2:
//Accelerates both motors from 0 to 30% power over 3 seconds
celerate(4,0,30,3);
//sets both motors to 30% power
motorSpeed(4,30);
//previous task goes until the AEV hits 247 marks
goToAbsolutePosition(247);
//brakes all motors
brake(4);
//previous task goes until AEV hits 283 marks
goToAbsolutePosition(283);
//rotates the servo to 40 degrees
rotateServo(40);
//previous task goes for 6 seconds
goFor(6);
//rotates the servo to 0 degrees
rotateServo(0);
//previous task goes for 1 seconds
goFor(1);
//sets motor 1 to 25% power
motorSpeed(1,25);
//sets motor 2 to 25% power
motorSpeed(2,25);
//previous task goes until the AEV hits 427 marks
goToAbsolutePosition(427);
//reveres both motors
reverse(4);
//previous task goes until the AEV hits 625 marks
goToAbsolutePosition(625);
//previous task goes for 5 seconds
goFor(5);
//sets both motors to 50% power
motorSpeed(4,50);
//previous task goes until the AEV hits 415 marks
goToAbsolutePosition(415);
8th Code- Code 2 for Performance Test 2:
//Accelerates both motors from 0 to 30% power over 3 seconds
celerate(4,0,30,3);
//sets both motors to 30% power
motorSpeed(4,30);
//previous task goes until the AEV hits 247 marks
goToAbsolutePosition(247);
//brakes all motors
brake(4);
//previous task goes until AEV hits 283 marks
goToAbsolutePosition(283);
//rotates the servo to 40 degrees
rotateServo(40);
//previous task goes for 6 seconds
goFor(6);
//rotates the servo to 0 degrees
rotateServo(0);
//previous task goes for 1 seconds
goFor(1);
//sets motor 1 to 25% power
motorSpeed(1,25);
//sets motor 2 to 25% power
motorSpeed(2,25);
//previous task goes for 5 seconds
goFor(5);
Code 1 for Performance Test 2:
//Accelerates both motors from 0 to 30% power over 3 seconds
celerate(4,0,30,3);
//sets both motors to 30% power
motorSpeed(4,40);
//previous task goes until the AEV hits 246 marks
goToAbsolutePosition(246);
//brakes all motors
brake(4);
//previous task goes until AEV hits 272 marks
goToAbsolutePosition(272);
//rotates the servo to 40 degrees
rotateServo(40);
//previous task goes for 6 seconds
goFor(6);
//rotates the servo to 0 degrees
rotateServo(0);
//previous task goes for 1 seconds
goFor(1);
//sets motor 1 to 25% power
motorSpeed(1,25);
//sets motor 2 to 25% power
motorSpeed(2,25);
//previous task goes until the AEV hits 427 marks
goToAbsolutePosition(427);
//reveres both motors
reverse(4);
//previous task goes until the AEV hits 625 marks
goToAbsolutePosition(625);
//previous task goes for 5 seconds
goFor(5);
//sets both motors to 50% power
motorSpeed(4,50);
//previous task goes until the AEV hits 415 marks
goToAbsolutePosition(415);
9th Code- Final Performance Test
//sets both motors to 45% power
motorSpeed(4,45);
//previous task goes until the AEV hits 247 marks
goToAbsolutePosition(218);
//brakes all motors
brake(4);
//previous task goes until AEV hits 283 marks
goToAbsolutePosition(245);
//rotates the servo 40 degrees
rotateServo(65);
//previous task goes for 6.5 seconds
goFor(6.5);
//rotates the servo to 0 degrees
rotateServo(0);
//previous task goes for 1 seconds
goFor(1);
//sets both motors to 35% power
motorSpeed(1,25);
motorSpeed(2,25);
goToAbsolutePosition(414);
reverse(4);
goToAbsolutePosition(625);
goFor(5.5);
motorSpeed(4,60);
//previous task goes until AEV hits 418 marks
goToAbsolutePosition(418);
//brakes all motors
brake(4);
//previous task goes until AEV hits 365 marks
goToAbsolutePosition(365);
//rotates the servo 40 degrees
rotateServo(65);
//previous task goes for 3 seconds
goFor(1);
//rotates the servo to 0 degrees
rotateServo(0);
//previous task goes for 4 seconds
goFor(7);
//sets both motors to 65% power
motorSpeed(1,65);
motorSpeed(2,65);
//previous task goes until AEV hits 300 marks
goToAbsolutePosition(300);
motorSpeed(4,50);
//previous task goes until AEV hits 250 marks
goToAbsolutePosition(250);
//reverses both motors
reverse(4);
//sets both motors to 25% power
motorSpeed(4,25);
//previous task goes for 3 seconds
goFor(3);
//brakes all motors
brake(4);
//previous task goes until AEV hits 3 marks
goToAbsolutePosition(2);
//rotates the servo 40 degrees
rotateServo(65);
//previous task goes for 2 seconds
goFor(5);
//rotates the servo to 0 degrees
rotateServo(0);