KOP rangefinder

So I tried hooking up the KOP rangefinder to the analog breakout, but when I run the program, the only output I get is 0. I can hear the rangefinder pinging, and when I hook up a voltmeter, there is a change in voltage when an object is placed at different positions in front of it.

How I hooked it up:

Code I used:

AnalogChannel *rangefinder;

rangefinder = new AnalogChannel(1);

std::cout<<rangefinder->getVoltage()<<endl;

You did plug the sensor into Analog Input 1 on the breakout, right? If it’s getting power and outputting a voltage, you have the connector in the right orientation, but it might be on the wrong pins. Do you have code sending raw sensor input to the Dashboard?

Nothing else is configured for AnalogChannel(1), right? If you defined e.g. a gyro on that input earlier, trying to define the sonar sensor on the same input will fail. If that’s the problem, I’d expect to see a message to that effect on the Driver Station diagnostic log.