EXERCISE 2- REFLECTANCE SENSORS

P-R&D #2: In this lab, the reflective sensors were built and tested.

REFLECTIVE SENSORS
CODE
// Run all motors at a constant speed of 25% power for 2 seconds
motorSpeed(4, 25);
goFor(2);
// Run all motors at a constant speed of 20% and using the
// goToAbsolutePosition function travel a total distance of 12 feet (from the starting point)
motorSpeed(4, 20);
goToAbsolutePosition(295);
// Reverse motors
reverse(4);
// Run all motors at a constant speed of 30% power for 1.5 second
motorSpeed(4, 30);
goFor(1.5);
// Brake all motors
brake(4);

 

PURPOSE OF REFLECTIVE SENSORS

The function of the reflectance sensors can be used to count the number of times the wheels attached to the monorail turn as well as if the AEV is moving forward or backwards. They are important in completing the MCR because knowing which way the AEV is turning is fundamental in designing the AEV and developing the code.