I can't seem to wrap my head around this. When my robot sees something on the right I want it to go left. When it sees something on the left, I want it to go right. When something jumps in front of it, it goes backwards. Don't worry about the values. I just need to know if this is the correct control structure:

//control scannerif (IR < thresh)//doesn't see anything rotate_left();else //sees something rotate_right();Its a little bit more complicated than this, and you'll have oscillation issues for sure so you'll have to play around with it.