EXERCISE 2: REFLECTANCE SENSOR TEST

Exercise 2:

// Run all motors for 2 seconds at 25% power

motorSpeed(4,25);

goFor(2);

//decrease motor speeds to 20% and go 12 feet at this speed

motorSpeed(4,20);

goToAbsolutePosition(296); //goes to approximately 12′, which is actually 295.3846, rounded up to ensure it travels at least 12′

//reverse the motors and run them for 1.5 seconds at 30%

reverse(4);

motorSpeed(4,30);

goFor(1.5);

//stop all motors…

brake(4);

 

Using knowledge of Arduino and the OSU function library, Division C created the above program to test the revolutions a wheel will spin per second. As the wheel spun, the program calculated how often the wheel completed a full rotation. In addition, this  lab required building the prototype connecting two wheels to the “L shape” piece, ensuring the wheel with reflective tape faced the sensors. Though a relatively simple procedure, it was challenging to calculate how long 12 feet was in the units the code required as well as how to connect the sensors to the Arduino. Below is a picture of how the sensors were secured to the AEV.

 

MCR Referenced in this exercise