Ultrasonic Range Finder Program

Hey everyone,

I have finished programming the driver control program and I was starting to begin programming the autonomous program and I was wondering how you are supposed to program the ultrasonic range finder in RobotC.

please, google this before you post on the forums. This is contributing to the amount of similar questions we get every day. But, because I am nice, here are some links to relevant articles/posts .
http://www.robotc.net/tutor/NXT/nxt.php?platform=NXT&unit=sensors&lesson=2
http://cdn.robotc.net/pdfs/natural-language/hp_sonar.pdf
http://www.robotc.net/wikiarchive/NXT_Sensors_Overview

Do a bunch of tests with the ultrasonic sensors. They like being away form the wall a little bit (not too close or you read -1), like being perpendicular to a flat surface (not at an angle), multiple ultrasonic sensors can act weird if one is reading the other (unlikely to run into this), and the disbursement pattern of the sensor can be tricky if there is a round cone in the way with these funky angles where the signals bounce off.

So using these in conjunction with the gyro to know when to trust it can be useful.

Try a bunch of tests and find where you can use it. Staying parallel to a wall is especially useful or driving from/to and open wall spot you can rely on are especially good uses for them.

I wrote a lengthy article last week on all the ins-and-outs of the ultrasonic range finder. Hope you find it useful. And to ditto @Team80_Giraffes, the 2nd section of the article is titled “Test Test Test”.
https://renegaderobotics.org/vex-sensors-ultrasonic-range-finder/