Ultrasonic Sensor

We’re writing our robot’s code in C++. So far, so good, but we can’t seem to figure out how to work with the ultrasonic sensor that came with the kit of parts. We’re using the AnalogChannel class, but that isn’t working. How should we initialize it. We can’t use the Ultrasonic class because that’s designed for a different ultrasonic sensor. The one that we’re using, which is the one from the kit of parts, can be found at this website: https://www.adafruit.com/products/172. Does anyone have any idea what we should do? What class do we use? Thanks.

AnalogChannel works as intended - Which probably means you aren’t initializing it right or you’re hooking it up wrong. If you have it hooked into slot 1 at port X, you should have something along the lines of

AnalogChannel* ultrasonic = new AnalogChannel(1, X);

Then, you just do ultrasonic->GetVoltage(); to return the voltage back from it.

As a reference, http://maxbotix.com/products/LV.htm
I don’t recall the exact model, but make sure pin 1 is grounded to the analog input module (0v, or -, depending on the markings on the analog input module), pin 2 is connected to the +5V on the analog input module, and pin 5, the voltage output (not any of the other pins), is connected to the sensor pin on the analog module.