Past Codes

Arduino Codes Used for PR&D, AR&D and other testing

Code used for the PR&D

INITIAL TESTING PROGRAM :

void myCode()
{
//—————————————————————————————-
// myCode();
//
// This is the tab where the programming of your vehicle operation is done.
// Tab _00_AEV_key_words contains a compiled list of functions/subroutines used for vehicle
// operation.
//
// Note:
// (1) After running your AEV do not turn the AEV off, connect the AEV to a computer, or
// push the reset button on the Arduino. There is a 13 second processing period. In
// post processing, data is stored and battery recuperation takes place.
// (2) Time, current, voltage, total marks, position traveled are recorded approximately
// every 60 milliseconds. This may vary depending on the vehicles operational tasks.
// It takes approximately 35-40 milliseconds for each recording. Thus when programming,
// code complexity may not be beneficial.
// (3) Always comment your code. Debugging will be quicker and easier to do and will
// especially aid the instructional team in helping you.
//—————————————————————————————-
// Program between here——————————————————————-
celerate(4,0,25,3); //accel all motors to 25% power in 3 seconds
goFor(1); //continue at 25% power for 1 second
motorSpeed(4,20); //set all motors to 20% power
goFor(2); //continue all motors at 20% power for 2 seconds
reverse(4); //reverse all motors
motorSpeed(4,25); //set all motors to 25% power
goFor(2); //continue all motors at 25% power for 2 seconds
brake(4); //brake all motors
// And here——————————————————————————–
} // DO NOT REMOVE. end of void myCode()
________________________________________

LAB 1:

void myCode()
{
//—————————————————————————————-
// myCode();
//
// This is the tab where the programming of your vehicle operation is done.
// Tab _00_AEV_key_words contains a compiled list of functions/subroutines used for vehicle
// operation.
//
// Note:
// (1) After running your AEV do not turn the AEV off, connect the AEV to a computer, or
// push the reset button on the Arduino. There is a 13 second processing period. In
// post processing, data is stored and battery recuperation takes place.
// (2) Time, current, voltage, total marks, position traveled are recorded approximately
// every 60 milliseconds. This may vary depending on the vehicles operational tasks.
// It takes approximately 35-40 milliseconds for each recording. Thus when programming,
// code complexity may not be beneficial.
// (3) Always comment your code. Debugging will be quicker and easier to do and will
// especially aid the instructional team in helping you.
//—————————————————————————————-
// Program between here——————————————————————-
celerate(1,0,15,2.5); //accel motor 1 to 15% power in 2.5 seconds
goFor(1); //continue at 15% power for 1 second
brake(1); //brake motor 1
celerate(2,0,27,4); //accel motor 2 to 27% power in 4 seconds
goFor(2.7); //continue at 27% power for 7 seconds
celerate(2,27,15,1); //decel motor 2 from 27% to 15% power in 1 second
brake(2); //brake motor 2
reverse(2); //reverse direction of motor 2
celerate(4,0,31,2); //accel all motors from 0 to 31% power in 2 seconds
motorSpeed(4,35); //set all motor powers to 35%
goFor(1); //continue at 35% power for 1 second
brake(2); //brake motor 2
goFor(3); //let motor 1 run at 35% power for 3 seconds
brake(4); //brake all motors
goFor(1); //pause for 1 second
reverse(1); //reverse direction of motor 1
celerate(1,0,19,2); //accel motor 1 to 19% power in 2 seconds
motorSpeed(2,35); //set motor 2 at 35% power
goFor(2); //continue for 2 seconds
motorSpeed(1,19); //set motor 1 to 19% power
goFor(2); //continue for 2 seconds
celerate(4,19,0,3); //decel all motors to stop in 3 seconds
brake(4); //brake all motors
// And here——————————————————————————–
} // DO NOT REMOVE. end of void myCode()

LAB 2:

void myCode()
{
//—————————————————————————————-
// myCode();
//
// This is the tab where the programming of your vehicle operation is done.
// Tab _00_AEV_key_words contains a compiled list of functions/subroutines used for vehicle
// operation.
//
// Note:
// (1) After running your AEV do not turn the AEV off, connect the AEV to a computer, or
// push the reset button on the Arduino. There is a 13 second processing period. In
// post processing, data is stored and battery recuperation takes place.
// (2) Time, current, voltage, total marks, position traveled are recorded approximately
// every 60 milliseconds. This may vary depending on the vehicles operational tasks.
// It takes approximately 35-40 milliseconds for each recording. Thus when programming,
// code complexity may not be beneficial.
// (3) Always comment your code. Debugging will be quicker and easier to do and will
// especially aid the instructional team in helping you.
//—————————————————————————————-
// Program between here——————————————————————-
motorSpeed(4,25); //set all motors to 25% power
goFor(2); //run all motors for 2 seconds
motorSpeed(4,20); //set all motors to 20% power
goToAbsolutePosition(299.533); //go 12 feet from starting point
reverse(4); //reverse all motors
motorSpeed(4,30); //set all motors to 30% power
goFor(1.5); //continue for 1.5 seconds
brake(4); //brake all motors
// And here——————————————————————————–
} // DO NOT REMOVE. end of void myCode()
________________________________________

Code used for the AR&D
AR&D #1:

void myCode()
{
//—————————————————————————————-
// myCode();
//
// This is the tab where the programming of your vehicle operation is done.
// Tab _00_AEV_key_words contains a compiled list of functions/subroutines used for vehicle
// operation.
//
// Note:
// (1) After running your AEV do not turn the AEV off, connect the AEV to a computer, or
// push the reset button on the Arduino. There is a 13 second processing period. In
// post processing, data is stored and battery recuperation takes place.
// (2) Time, current, voltage, total marks, position traveled are recorded approximately
// every 60 milliseconds. This may vary depending on the vehicles operational tasks.
// It takes approximately 35-40 milliseconds for each recording. Thus when programming,
// code complexity may not be beneficial.
// (3) Always comment your code. Debugging will be quicker and easier to do and will
// especially aid the instructional team in helping you.
//—————————————————————————————-

// Program between here——————————————————————-
motorSpeed(4,25);
goFor(10);
brake(4);

// And here——————————————————————————–

} // DO NOT REMOVE. end of void myCode()

AR&D #2:

void myCode()
{
//—————————————————————————————-
// myCode();
//
// This is the tab where the programming of your vehicle operation is done.
// Tab _00_AEV_key_words contains a compiled list of functions/subroutines used for vehicle
// operation.
//
// Note:
// (1) After running your AEV do not turn the AEV off, connect the AEV to a computer, or
// push the reset button on the Arduino. There is a 13 second processing period. In
// post processing, data is stored and battery recuperation takes place.
// (2) Time, current, voltage, total marks, position traveled are recorded approximately
// every 60 milliseconds. This may vary depending on the vehicles operational tasks.
// It takes approximately 35-40 milliseconds for each recording. Thus when programming,
// code complexity may not be beneficial.
// (3) Always comment your code. Debugging will be quicker and easier to do and will
// especially aid the instructional team in helping you.
//—————————————————————————————-

// Program between here——————————————————————-
motorSpeed(4,20);
goFor(4);
brake(4);

// And here——————————————————————————–

} // DO NOT REMOVE. end of void myCode()

 

CODE FOR PERFORMANCE TESTS

 

Code for Performance Test#1

Code for performance test 1 in HI 224:

void myCode()

{

//—————————————————————————————-

// myCode();

//

// This is the tab where the programming of your vehicle operation is done.

// Tab _00_AEV_key_words contains a compiled list of functions/subroutines used for vehicle

// operation.

//

// Note:

// (1) After running your AEV do not turn the AEV off, connect the AEV to a computer, or

//     push the reset button on the Arduino. There is a 13 second processing period. In

//     post processing, data is stored and battery recuperation takes place.

// (2) Time, current, voltage, total marks, position traveled are recorded approximately

//     every 60 milliseconds. This may vary depending on the vehicles operational tasks.

//     It takes approximately 35-40 milliseconds for each recording. Thus when programming,

//     code complexity may not be beneficial.

// (3) Always comment your code. Debugging will be quicker and easier to do and will

//     especially aid the instructional team in helping you.

//—————————————————————————————-

 

// Program between here——————————————————————-

 

reverse(4);

motorSpeed(4,40);

goFor(1);

motorSpeed(4,20);

goToAbsolutePosition(250);

reverse(4);

motorSpeed(4,30);

goFor(1);

brake(4);

reverse(4);

motorSpeed(4,0);

goFor(7);

motorSpeed(4,40);

goFor(2);

brake(4);

 

 

 

// And here——————————————————————————–

 

} // DO NOT REMOVE. end of void myCode()

 

 

Code for Performance Test 1 in HI 308:

void myCode()

{

//—————————————————————————————-

// myCode();

//

// This is the tab where the programming of your vehicle operation is done.

// Tab _00_AEV_key_words contains a compiled list of functions/subroutines used for vehicle

// operation.

//

// Note:

// (1) After running your AEV do not turn the AEV off, connect the AEV to a computer, or

//     push the reset button on the Arduino. There is a 13 second processing period. In

//     post processing, data is stored and battery recuperation takes place.

// (2) Time, current, voltage, total marks, position traveled are recorded approximately

//     every 60 milliseconds. This may vary depending on the vehicles operational tasks.

//     It takes approximately 35-40 milliseconds for each recording. Thus when programming,

//     code complexity may not be beneficial.

// (3) Always comment your code. Debugging will be quicker and easier to do and will

//     especially aid the instructional team in helping you.

//—————————————————————————————-

 

// Program between here——————————————————————-

 

reverse(4);

motorSpeed(4,40);

goFor(1);

motorSpeed(4,21);

goToAbsolutePosition(245);

reverse(4);

motorSpeed(4,30);

goFor(1.8);

brake(4);

reverse(4);

motorSpeed(4,0);

goFor(8);

motorSpeed(4,30);

goFor(2);

brake(4);

 

 

 

// And here——————————————————————————–

 

} // DO NOT REMOVE. end of void myCode()

 

Performance Test#2

Code for Performance Test 2 in HI 224:

void myCode()

{

//—————————————————————————————-

// myCode();

//

// This is the tab where the programming of your vehicle operation is done.

// Tab _00_AEV_key_words contains a compiled list of functions/subroutines used for vehicle

// operation.

//

// Note:

// (1) After running your AEV do not turn the AEV off, connect the AEV to a computer, or

//     push the reset button on the Arduino. There is a 13 second processing period. In

//     post processing, data is stored and battery recuperation takes place.

// (2) Time, current, voltage, total marks, position traveled are recorded approximately

//     every 60 milliseconds. This may vary depending on the vehicles operational tasks.

//     It takes approximately 35-40 milliseconds for each recording. Thus when programming,

//     code complexity may not be beneficial.

// (3) Always comment your code. Debugging will be quicker and easier to do and will

//     especially aid the instructional team in helping you.

//—————————————————————————————-

 

// Program between here——————————————————————-

 

reverse(4);

motorSpeed(4,40);

goFor(1);

motorSpeed(4,20);

goToAbsolutePosition(246);

reverse(4);

motorSpeed(4,30);

goFor(1);

brake(4);

reverse(4);

motorSpeed(4,0);

goFor(9);

motorSpeed(4,30);

goFor(2);

brake(4);

motorSpeed(4,0);

goFor(3.8);

 

 

 

// getting the AEV back to the starting point

 

reverse(4);

motorSpeed(4,20);

celerate(4,20,60,1);

goFor(1);

motorSpeed(4,60);

goToRelativePosition(-250);

reverse(4);

motorSpeed(4,40);

goFor(1);

brake(4);

reverse(4);

motorSpeed(4,0);

goFor(9);

motorSpeed(4,40);

goFor(2);

brake(4);

 

 

 

// And here——————————————————————————–

 

} // DO NOT REMOVE. end of void myCode()

 

 

Code for Performance Test 2 in HI 308:

 

void myCode()
{
//—————————————————————————————-
// myCode();
//
// This is the tab where the programming of your vehicle operation is done.
// Tab _00_AEV_key_words contains a compiled list of functions/subroutines used for vehicle
// operation.
//
// Note:
// (1) After running your AEV do not turn the AEV off, connect the AEV to a computer, or
// push the reset button on the Arduino. There is a 13 second processing period. In
// post processing, data is stored and battery recuperation takes place.
// (2) Time, current, voltage, total marks, position traveled are recorded approximately
// every 60 milliseconds. This may vary depending on the vehicles operational tasks.
// It takes approximately 35-40 milliseconds for each recording. Thus when programming,
// code complexity may not be beneficial.
// (3) Always comment your code. Debugging will be quicker and easier to do and will
// especially aid the instructional team in helping you.
//—————————————————————————————-

// Program between here——————————————————————-

reverse(4);
motorSpeed(4,40);
goFor(1);
motorSpeed(4,21);
goToAbsolutePosition(245);
reverse(4);
motorSpeed(4,30);
goFor(1.8);
brake(4);
reverse(4);
motorSpeed(4,0);
goFor(8);
motorSpeed(4,30);
goFor(2);
brake(4);
motorSpeed(4,0);
goFor(4);

// To make the AEV go in reverse after picking up the caboose
// getting the AEV back to the starting point

reverse(4);
motorSpeed(4,0);
goFor(5);
celerate(4,20,60,1);
goFor(1);
motorSpeed(4,60);
goToRelativePosition(-200);
reverse(4);
motorSpeed(4,50);
goFor(1);
brake(4);
reverse(4);
motorSpeed(4,0);
goFor(9);
motorSpeed(4,40);
goFor(2);
brake(4);

 

// And here——————————————————————————–

} // DO NOT REMOVE. end of void myCode()

 

Final Performance Tests

 

Code for the Final Performance Test  in HI 308:

void myCode()

{

//—————————————————————————————-

// myCode();

//

// This is the tab where the programming of your vehicle operation is done.

// Tab _00_AEV_key_words contains a compiled list of functions/subroutines used for vehicle

// operation.

//

// Note:

// (1) After running your AEV do not turn the AEV off, connect the AEV to a computer, or

//     push the reset button on the Arduino. There is a 13 second processing period. In

//     post processing, data is stored and battery recuperation takes place.

// (2) Time, current, voltage, total marks, position traveled are recorded approximately

//     every 60 milliseconds. This may vary depending on the vehicles operational tasks.

//     It takes approximately 35-40 milliseconds for each recording. Thus when programming,

//     code complexity may not be beneficial.

// (3) Always comment your code. Debugging will be quicker and easier to do and will

//     especially aid the instructional team in helping you.

//—————————————————————————————-

 

// Program between here——————————————————————-

 

reverse(4);

motorSpeed(4,40);

goFor(1);

motorSpeed(4,21);

goToAbsolutePosition(249);

reverse(4);

motorSpeed(4,30);

goFor(1.8);

brake(4);

reverse(4);

motorSpeed(4,0);

goFor(8);

motorSpeed(4,30);

goFor(2);

brake(4);

motorSpeed(4,0);

goFor(4);

 

// To make the AEV go in reverse after picking up the caboose

// getting the AEV back to the starting point

 

reverse(4);

motorSpeed(4,0);

goFor(5);

celerate(4,20,60,1);

goFor(1);

motorSpeed(4,60);

goToRelativePosition(-225);

reverse(4);

motorSpeed(4,70);

goFor(1);

brake(4);

reverse(4);

motorSpeed(4,0);

goFor(7);

motorSpeed(4,65);

goFor(1);

motorSpeed(4,60);

goFor(2);

brake(4);

motorSpeed(4,0);

goToAbsolutePosition(50);

reverse(4);

motorSpeed(4,70);

goFor(1);

brake(4);

 

 

// And here——————————————————————————–

 

} // DO NOT REMOVE. end of void myCode()

 

Code for the Final Performance Test  in HI 224:

void myCode()
{
//—————————————————————————————-
// myCode();
//
// This is the tab where the programming of your vehicle operation is done.
// Tab _00_AEV_key_words contains a compiled list of functions/subroutines used for vehicle
// operation.
//
// Note:
// (1) After running your AEV do not turn the AEV off, connect the AEV to a computer, or
// push the reset button on the Arduino. There is a 13 second processing period. In
// post processing, data is stored and battery recuperation takes place.
// (2) Time, current, voltage, total marks, position traveled are recorded approximately
// every 60 milliseconds. This may vary depending on the vehicles operational tasks.
// It takes approximately 35-40 milliseconds for each recording. Thus when programming,
// code complexity may not be beneficial.
// (3) Always comment your code. Debugging will be quicker and easier to do and will
// especially aid the instructional team in helping you.
//—————————————————————————————-

// Program between here——————————————————————-

reverse(4);
motorSpeed(4,40);
goFor(1);
motorSpeed(4,20);
goToAbsolutePosition(263);
reverse(4);
motorSpeed(4,40);
goFor(1);
brake(4);
reverse(4);
motorSpeed(4,0);
goFor(8);
motorSpeed(4,30);
goFor(2);
brake(4);
motorSpeed(4,0);
goFor(4);

// getting the AEV back to the starting point

reverse(4);
motorSpeed(4,0);
goFor(5);
celerate(4,20,60,1);
goFor(1);
motorSpeed(4,60);
goToRelativePosition(-225);
reverse(4);
motorSpeed(4,70);
goFor(1);
brake(4);
reverse(4);
motorSpeed(4,0);
goFor(7);
motorSpeed(4,80);
goFor(1);
motorSpeed(4,60);
goFor(2);
brake(4);
motorSpeed(4,0);
goToAbsolutePosition(50);
reverse(4);
motorSpeed(4,70);
goFor(1);

brake(4);

 

// And here——————————————————————————–

} // DO NOT REMOVE. end of void myCode()