Society of Robots - Robot Forum
Software => Software => Topic started by: Xyver on January 27, 2010, 12:40:55 AM
-
How hard would it be to convert the 50$ robot with rangefinder to be controlled by Arduino? I want it to avoid things in range instead of chasing them.
-
Depends if you know how to program an Arduino... You should be able to use the servo library (http://www.arduino.cc/en/Reference/Servo) to control the servos, but I don't think there's a rangefinder library. Do you know how to wire the servos/rangefinder?
-
It would not be too hard (to program), even if there is no library. Just keep track of where the servo is, and do a analogRead on the pin the IR is on, and convert that to a distance (or don't convert, thats optional, if you are just interested in avoiding things). If the servo is to the left, and the voltage(ie the return of analogRead() ) goes beyond a threshold, then have your robot go right.