SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
By paradox_qu
My robot has ir sensors around the out side of him. I want to make it so that when the ir sensor is triped the motors will reverse perminitly. I know how to make it so when the ir sensor is triped the motors reverse but after my robot moves away from the object the robot starts going forward again.

So imagian my robot moving foward then it detects an object then I want it to moved backwards untill the back sensor is triped.

Hi paradox_qu,

You need to change your code to a kind of 'latching' logic like so:

Drive motor forwards or backwards (Your choice)

If front sensor 'tripped' then reverse motor
If back sensor 'tripped' then forward motor

The code is looping and waiting for either sensor to 'trip' and then when it does trip, the appropriate 'permanent' action will be taken untill the next 'trip'

Cheers ADI
By paradox_qu
Thanks you very much ADI i think I figured out how to do it. Now I gotta go home and try it.
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]