Exercise 2: Reflectance Sensors

The reflectance sensors, which are the small red pieces that are attached around the white nut, measure the distance that the AEV travels by detecting when the metallic part of the wheel passes in front of the sensor. This metallic part can be seen above on the top right portion of the wheel. This function is essential in completing the task at hand because the AEv has to travel a certain distance to a gateway, then stop and wait for the gate to open before continuing on to the final destination. This distance can be measured in marks so the AEV can stop before the gate.

Code Used to Run Exercise:

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(2);
// run motors at 25% for two seconds
motorSpeed(4,20);
goToAbsolutePosition(295.384615);
//motors run until that distance is reached then motor stops
reverse(4); // reverses motors
motorSpeed(4,30);
goFor(1.5);
// run motors at 30% for 1.5sec
brake(4);

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

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