The reflectance sensors are a pivotal part of the AEV’s function. The reflectance sensors communicate with the arduino in order to determine the distance it has travelled along the track. The distance travelled by the arduino is determined through how many ‘marks’ the arduino travels during a given time. Each revolution of the AEV’s wheel along the track consists of 8 marks. Each mark is equivalent to 0.4875 inches/mark.
Code for the test of the AEV’s reflectance sensors:
motorSpeed(4,25); //Runs all motors at 25% power goFor(2); //motors run for 2 seconds motorSpeed(4,20); //Runs all motors at 20% power goToAbsolutePosition(70); //Motors run for 12ft reverse(4); //Reverse motor polarity of all motors motorSpeed(4,30); //Runs all motors at 30% power goFor(1.5); //Runs motors for 1.5 seconds brake(4); //Brakes all motors