Is there any way I can check if the Pololu VL6180x module is working properly (maybe a method I can call in the library)? When I try to simply do
after starting interleaved continuous mode (to make sure that the wire method returns 0, indicating that there is a responsive device on that address), the sensor does not work after that. That bit of code seems to interfere with the functioning of the sensor (the range readings will not respond to real life inputs).
So is there any way to do this without interfering with the working of the sensor?
(EDIT: the reason I want to do this is I want the robot I am making to let me know if the sensor gets disconnected by accident)
I am sorry you are having trouble communicating with your VL6180X. In general, those sensors need to be properly initialized in order to work, which involves more than just writing to different registers. If you are using an Arduino, you can test your sensor by running any of our example sketches. Can you get data when you run those sketches?
By the way, I suspect you probably typed out your statement correctly in your IDE, but this statement from your post has a typo:
Wire.beginTranmission(0x29); // incorrectly spelled
is missing the letter “s”:
Wire.beginTransmission(0x29); // correctly spelled
Thanks for the response. My sensors are actually working properly but so just want some way to ensure that they are working in my code (so basically prevent the code from running if the sensors are detached). Is this possible?
You might consider reading one of the identification registers, like
IDENTIFICATION__MODEL_ID. If you are using our Arduino library, it should not be difficult to notice if the VL6180X is disconnected from the I²C bus, since the function to end data transfers,
Wire.endTransmission(), will return a nonzero value if data transmission was not successful. You can check our
last_status variable to retrieve the status of the most recent ended transmission.
Perfect — that’s just what I needed, thanks.