We are using a Rev Color Sensor V3 at our intake to detect the ball’s presence and color when we pick it up. The sensor is plugged in to the MXP I2C port because of the suspected bug with the onboard I2C. I am printing out some raw sensor values to Shuffleboard to try and debug. The color sensor works fine for a while displaying ~160 proximity, then eventually it displays that it detects 0 proximity and also 0 red and 0 blue from the getRed() and getBlue() methods. Restarting the Rio through the driver stations seems to fix the issue, so it would seem like it is a code problem, but I am outputting raw values from the sensor, so I actually have no clue what could be wrong.
I’ve seen that thread before, but I never got the the part about then MXP port also being problematic, especially when on WPILib they put using the MXP port as a solution to this I2C problem. Thanks for the help!
Yeah I didn’t experience the rio crashing, but the color sensor just would stop responding, so it’s probably a good idea to not use the sensor unless you are doing something with the pi.
We are using the color sensor and it seems to have no issues. I made a example code just so it is less cluttered to look at. The code just uses proximity so you would need to add the get color functions. https://github.com/ClaytonM223/ColorSensorExample
It’s not the code that’s the problem in theory, it’s a problem with the firmware of the Rio or it’s hardware. It’s a strange bug as it occurs for some Rios but not others. It also seems to occur somewhat randomly, which is more confusing.
You probably got a lucky Rio that doesn’t experience this bug or you’ve just never encountered it.