PHOTORESISTOR ALGORITHMS - 0 views
www.societyofrobots.com/rogramming_photoresistor.shtml
algorithm photoresistor photovore robot sensor
![](/images/link.gif)
-
-
pseudocode: read left_photoresistor read right_photoresistor if left_photoresistor detects more light than right_photoresistor then turn robot left if right_photoresistor detects more light than left_photoresistor then turn robot right if right_photoresistor detects about the same as left_photoresistor then robot goes straight loop
-
Photovore Algorithm, Improved This algorithm does the same as the original, but instead of case-based it works under a more advanced Fuzzy Logic control algorithm. Your robot will no longer just have the three modes of turn left, turn right, and go forward. Instead will have commands like 'turn left by 10 degrees' or 'turn right really fast', and with no additional lines of code! pseudocode: read left_photoresistor read right_photoresistor left_motor = (left_photoresistor - right_photoresistor) * arbitrary_constant right_motor = (right_photoresistor - left_photoresistor) * arbitrary_constant loop
- ...1 more annotation...
-
Photovore, Split Brain Approach This algorithm works without comparison of photoresistor values. Instead, just command the right motor based on light from the right sensor, and the left motor with only data from the left sensor. You can also get interesting variations by reversing the sensors for a cross-Brain algorithm. pseudocode: read left_photoresistor read right_photoresistor move left_wheel_speed = left_photoresistor * arbitrary_constant move right_wheel_speed = right_photoresistor * arbitrary_constant loop