Arduino Codes

void myCode()
{
//—————————-————————————————————
// myCode();
//
// This is the tab where student programming is done.
// A list of available function calls are listed in detail under tab “00_Student_Functions”
//
// Note:
// (1) After running your program do not turn the controller off, connect the controller 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, forward marks, and backward marks 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————————–—————————————–

//Test 1, reflectanceSensorTest
reflectanceSensorTest();
getForwardCounts();
getBackwardCounts();

//Test 2, test for the servo
rotateServo(180);
pauseFor(2);
rotateServo(0);
pauseFor(3);

//Test 3, 150_count_noStop
//Start servo off parallel to track

rotateServo(90.00);
pauseFor(5);

// While distance travelled is less than 100 counts, motors are 40% speed

while (getTotalCounts() < 100) {
motorSpeed(4, -40);
}

//Stop motors and brake
motorSpeed(4,0);
rotateServo(150);

//Test 4, fullLength Test

//Start servo off parallel to track

rotateServo(90);
pauseFor(5);

// While distance travelled is less than 100 counts, motors are 40% speed

while (getTotalCounts() < 325) {
motorSpeed(4, -35);
}

//Stop motors and brake
motorSpeed(4,0);
rotateServo(165);

//Test 5, full length test
//Start servo off parallel to track

rotateServo(90);
pauseFor(5);

// While distance travelled is less than 100 counts, motors are 40% speed

while (getTotalCounts() < 600) {
motorSpeed(4, -30);
}

//Stop motors and brake
motorSpeed(4,0);
rotateServo(165);

//Test 6, 100 counts stop
rotateServo(90);
pauseFor(5);

// While distance travelled is less than 100 counts, motors are 35% speed

while (getTotalCounts() < 100) {
motorSpeed(4, -40);

}
motorSpeed(4,10);
rotateServo(165);
pauseFor(10);

rotateServo(90);
while (getTotalCounts() < 200) {
motorSpeed(4, -40);

}
motorSpeed(4,10);
rotateServo(165);
pauseFor(10);

rotateServo(90);
while (getTotalCounts() < 300) {
motorSpeed(4, -40);

}
motorSpeed(4,10);
rotateServo(165);
pauseFor(10);

rotateServo(90);
while (getTotalCounts() < 400) {
motorSpeed(4, -40);

}
motorSpeed(4,10);
rotateServo(165);
pauseFor(10);

rotateServo(90);
while (getTotalCounts() < 500) {
motorSpeed(4, -40);

}
motorSpeed(4,10);
rotateServo(165);
pauseFor(10);

rotateServo(90);
while (getTotalCounts() < 600) {
motorSpeed(4, -40);

}
motorSpeed(4,0);
rotateServo(165);

//Test 7, minimum speed test
rotateServo(90);
pauseFor(5);
while (getTotalCounts() < 100) {
motorSpeed(4, -5);
}
motorSpeed(4,0);
rotateServo(165);

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

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