Distance sensor not working(?)

We have two V5 distance sensors (not the ultrasonic ones) that we got shipped in recently, and I am trying to figure out how to get them to work. I have tried many times to get them to work, but I always just get a default value. I feel like I am missing something critical.

This is the simplest version of the code that I am testing the sensors with
(printf doesn’t seem to work on my laptop)

void initialize() {


void opcontrol() {

pros::Distance distance_sensor(13);


pros::lcd::set_text(5, std::to_string( distance_sensor.get()));




I can’t exactly remember, but you should be able to view the distance sensor output in the sensor menu on the V5 robot - if this is displaying a value then you’ll know it’s not the distance sensor which isn’t working.

1 Like

Go to devices on brain menu:

(Mine are on 12 and 13)

Click on the icon and it will take you to this page, where you could potentially diagnose issues: