I am new to C, and before my Axon and other parts arrive, I need a code written for me.
I plan to put two IR sensors on each side of the robot, so that it has stereoscopic vision and can therefore make smart decisions about which way to turn, not just to turn. I need a script that does the following:
Start going straight relatively fast
If left or right IR measures less than 6cm in distance, then
See if Left IR value>Right IR Value, if yes turn left (Right servo 50 revolutions, Left servo 25 revolutions, then keep going straight), if no turn right (Left servo 50 revolutions, Right servo 25 revolutions, then keep going straight). I just need the robot to make a slight right or left turn, so you may tweak the number of revolutions to get it right for a very small (3x3x3) robot. Assume that the left IR goes on ADC 1 and the right on ADC 2, and that the left servo goes on E2 and E3 on the I/O.