Let's Make Robots!

avoidance

raspberry pi arduino,

So im pretty newish to robotics and programming in general, but ive done some reading and have started down my own path.

my robot(including a picture, description, wiring diagram and code) is posted here http://letsmakerobots.com/node/40350

The robot moves avoiding obstacles and choosing the best way to follow by ultrasound.
Using a
The programming code is attached here as a .txt file. Download it and paste the text on the Arduino compiler. Remember to add the IRremote library (also attached … Read more
right now all it does is avoid obstacles, but i hope to program it to have other functions.   Read more

Programming help, sharp IR mounted on servo

Hello

I am trying to control my bot using a sharp IR sensor mounted on hitec servo with arduino mega. The pseudocode i have so far is as follows:

1. Set servo at 90deg and read IR sensor value
2. If val > 200, then stop the bot for a second
  a. Turn servo 0 deg completely and read ir val
  b. if val < 200 then turn bot left
  c. else turn servo 180 deg and read ir val
  d. if val < 200 then turn bot right
  e. else if cant turn right or left, reverse a bit and then turn the bot 180 degree and go straight.