Distance Sensor help needed

This code doesn’t go forward and says that the sensor detects 0.00 mmimage

iirc, the distance sensor returns -1, which is less than 300, if it doesn’t detect anything.


How far away is the target that the sensor is looking at? Also, can we see a picture of the mount?


If the sensor is close to the ground or a wall of some kind, it will think something is in front of it. I had similar trouble with this before, and I just needed to move the sensor farther off the ground. This was an IQ distance sensor though, I’ve never used a V5 distance sensor.


That is your problem. The V5 distance sensor and IQ distance sensor, as far as I know, encode information in different ways. So when the brain receives the IQ distance sensor values, it doesn’t know what it is saying. What I would do first is to change out your sensor to a V5 sensor

I think we are assuming that the original question was meant for a V5 sensor. I think @Time_Genius was simply stating that they had this issue with a IQ sensor and that it might work for the V5 one.
Maybe I’m misunderstanding but I’m pretty sure the issue is not what kind of sensor they are using.


image This is a picture of the mount. Also when we view the device in the devices module of the brain, it is detecting the right values unlike in autonomous code