Prototype Programs

Shown below are the codes that were created in the process of developing the final program used during each test 

 


Performance Test One

 

– PT1.i – this program was meant to perform PT 1 but failed

//reverse both motors
reverse(4);

//Accelerate both motors to 40% in 3 seconds
celerate(4,0,40,3);

//keep going for one second
motorSpeed(4,40);
goFor(1.75);

//brake both motors
brake(4);

//reverse
reverse(4);
celerate(4,0,40,1.25);
motorSpeed(4,40);
goFor(1.5);

 

-PT1.ii – This program utilized the servo motor in order to complete PT1. Ultimately scrapped because it was deemed inefficient

//reverse both motors
reverse(4);

//Accelerate both motors to 40% in 3 seconds
celerate(4,0,40,3);

//keep going for one second
motorSpeed(4,40);
goFor(1.5);

//brake both motors
brake(4);

//roatate servo
rotateServo(40);

-PT1.iii – Another code made to complete PT1. Written shortly after servo was removed 

//reverse both motors
reverse(4);

//Accelerate both motors to 40% in 3 seconds
celerate(4,0,40,3);

//keep going for one second
motorSpeed(4,40);
goFor(1.5);

//brake both motors
brake(4);

//reverse
reverse(4);


Performance Test Two

 

– PT2.i- From performance test one, the team decided to go forward and change the method from time to distance. Therefore, the reflective sensors are being used and the code for goFor was changed to the goToRelativePosition command.

//accelerate the motors
celerate(4,0,35,2);

//go to 20 marks
motorSpeed(4,35);
goToRelativePosition(-192);

//brake
brake(4);

reverse(4);
celerate(4,0,30,2);
motorSpeed(4,30);
goFor(.75);

 

-PT2.ii- The team decided to remove the accelerate command because the motors do not move the AEV until about 6%-10%. Therefore, the AEV may vary each run.

//go to 20 marks
motorSpeed(4,35);
goToRelativePosition(-205);

//brake
brake(4);

reverse(4);
celerate(4,0,30,2);
motorSpeed(4,30);
goFor(.75);

brake(4);
goFor(7);

reverse(4);
motorSpeed(4,40);
goToRelativePosition(-25);


Performance Test Three – Final Test

 

-PT3.i- This code is very similar to multiple other that were varied while preparing for PT3. The commands are the same for each of those variations, their only differences being the numbers within the commands. 

//go to 20 marks
motorSpeed(4,40);
goToRelativePosition(-220);

//brake
brake(4);

reverse(4);
motorSpeed(4,35);
goFor(.75);

//going through the gate
brake(4);
goFor(11);

reverse(4);
motorSpeed(4,40);
goToRelativePosition(-95);
brake(4);

//stopping in the loading zone
goFor(12);
reverse(4);
motorSpeed(4,60);
goToRelativePosition(135);
brake(4);
reverse(4);
motorSpeed(4,40);
goFor(1);

//going through gate
reverse(4);
motorSpeed(4,35);
goToRelativePosition(100);
brake(4);
reverse(4);
motorSpeed(4,30);
goFor(1);


 

For an index of Arduino syntax, click here.