To recap, we have four infra-red sensors and two motors working together in order to point our lamp device at the greatest IR source in the room. In order to do this our Arduino has to take in the information from the IR sensors perform logic and respond with output to the servos motors to make them spin in one direction or the other.
The IR sensors work very simply, if they detect IR light they increase in resistance and the number the Arduino reads from the sensor decreases. So if one sensor is reading lower than it's partner then the amount of IR light is greater in that direction.
Servo motors work on degrees. The Arduino sends a specific number correlating to a degree. This range can vary depending on your servo motors, some servos go from 0-180, some from 0-360, and some are continuous. If your servo motor is continuous then it actually takes a value from the Arduino and spins in that velocity in either a clockwise or counter clockwise direction. For us we have one servo that spins from 0-180 degrees (Y axis or Up vs Down) and one that is continuous (X axis or Left vs Right).
So the Input are the IR sensors. The Logic is the translation of the value the IR sensors are sending to the Arduino and then the corresponding value that the Arduino sends to the servos. And the Output is the servos spinning to point the lamp.
Here is our pseudo code:
No comments:
Post a Comment