Code

Lab 1 – Programming Basics:

//accelerate motor 1 for 2.5 seconds

celerate(1,0,15,2.5);

//run motor 1 at 15 percent and go for 1 second

motorSpeed(1,15);

goFor(1);

// brake motor 1

brake(1);

//accelerate motor 2 for 4 seconds

celerate(2,0,27,4);

//run motor 2 at 27 percent for 2.7 seconds

motorSpeed(2,27);

goFor(2.7);

//decelerate motor 2 from 27 to 15 for 1 second

celerate(2,27,15,1);

//brake motor 2

brake(2);

//reverse motor 2

reverse(2);

//accelerate motor 1 and 2 for 2 seconds for 31 percent

celerate(1,0,31,2);

celerate(2,0,31,2);

//go both motors at 35 percent for 1 second

motorSpeed(1,35);

motorSpeed(2,35);

goFor(1);

//brake motor 2

brake(2);

//make motor 1 go for 3 seconds

goFor(3);

//brake motor 1

brake(1);

//brake both motors for 1 and 2

goFor(1);

//reverse motor 1

reverse(1);

//accelerate motor 1 to 19 percent for 2 seconds

celerate(1,0,19,2);

//run motor 2 at 35 percent and motor 1 for 19 percent

motorSpeed(2,35);

motorSpeed(1,19);

//have both go for 2 seconds

goFor(2);

//decelerate both motors to 0

celerate(1,19,0,3);

celerate(2,35,0,3);

//brake both motors

brake(1);

brake(2);

 

Lab 2 – Reflectance Sensors:

//run motor 1 and 2 at 25% for 2 sec

motorSpeed(1,25);

motorSpeed(2,25);

goFor(2);

//run motor 1 and 2 at 20% for 12 feet aka 70.2 marks

motorSpeed(1,20);

motorSpeed(2,20);

goToAbsolutePosition(70.2);

//reverse motors

reverse(1);

reverse(2);

//run motors at 30% for 1.5 sec

motorSpeed(1,30);

motorSpeed(2,30);

goFor(1.5);

//brake motors

brake(1);

brake(2);

 

Lab 4 – Data Analysis Tool:

//Accelerate all motors from start to 25% in 3 seconds.

celerate(4, 0, 25, 3);

//Run all motors at a constant speed (25% power) for 1 second.

motorSpeed(4,25);

goFor(1);

//Run all motors at 20% power for 2 seconds.

motorSpeed(4,20);

goFor(2);

//Reverse all motors.

reverse(4);

//Run all motors at a constant speed (25% power) for 2 second.

motorSpeed(4,25);

goFor(2);

//Brake all motors.

brake(4);

 

Performance Test 1:

//reverse the propellers so that the AEV moves the right direction

reverse(4);

//Set at 30 percent to go for 4.8 seconds

motorSpeed(4,30);

goFor(4.8);

brake(4);

//stop at the gate

goFor(11);

//proceed through the gate

motorSpeed(4,30);

goFor(3);

brake(4);

 

Performance Test 2:

//reverse the propellers so that the AEV moves the right direction

reverse(4);

//Set at 30 percent to go for 4.8 seconds

motorSpeed(4,35);

goFor(4.7);

brake(4);

//stop at the gate

goFor(11);

//proceed through the gate

motorSpeed(4,30);

goFor(2.53);

brake(4);

goFor(11.5);

reverse(4);

motorSpeed(4,35);

goFor(10);

Final Test:

  //reverse the propellors so that the AEV moves the right direction

  //reverse(4);

  //Set at 30 percent to go for 4.8 seconds

  //motorSpeed(4,35);

  //goFor(4.5);

  //brake(4);

  //stop at the gate

  //goFor(12);

  //proceed through the gate

  //motorSpeed(4,30);

  //goFor(3.25);

  //Stop in loading zone for 5 seconds

  //brake(4);

  //goFor(11.5);

  //reverse motors to leave loading zone

  //reverse(4);

  //motorSpeed(4,40);

  //goFor(10);

  //brake at the sensor and wait to open

  //brake(4);

  //goFor(9);

  //Go through the gate

  //motorSpeed(4,40);

  //goFor(5);

  //brake(4);