Reflectance Sensor

The reflectance sensors, as seen in the picture below, are a crucial part of the AEV. They are able to read the light reflecting from the silver tape on the rotating wheel and from this, the Arduino can calculate the distance traveled.  This is important because it is the only way the program can read the position of the AEV while it is running on the track. Therefore, the team is able to program the AEV to stop when it gets to a certain distance (like when it reaches a distance close to the stop sign on the track). Team B then wrote the program seen below (Reflectance Sensors Senario Code) to observe how the reflectance sensors performed on the tracks.

Picture of Reflectance Sensors Attatched to AEV

 

Reflectance Sensors Senario Code

Code Comments
 motorSpeed(4,25); //start both motors at 25% power
 goToAbsolutePosition(70.2); //continue running both motors at 25% power until the AEV reaches 70.2 marks
 reverse(4); //reverse the rotation of both motors
 motorSpeed(4,30); //start both motors at 30% power
 goFor(1.5); //continue at the current settings for 1.5 seconds
 brake(4); //brake both motors

 

Using the function “reflectanceSensorsTest(),” which can be seen in the Arduino Code Glossary, the team was able to make sure that the sensors were connected to the Arduino properly (this test will always be performed before running the AEV). Then the team proceeded to run the AEV with the code seen above (Reflectance Sensors Senario Code) and realized the importance of the reflectance sensors.