Ultra sonic sensor programming question-robotc

Can someone help me out with a robotc question? I am trying to program the 'bot using a vex ultra sonic sensor. The idea is that the robot, once it detects an obstacle, will back up, look right to get a sensor reading, look left to get another sensor reading, then proceed in the direction of the highest value. Thanks!