How do you program a vision sensor on vexcode

Our team is new to using the newer sensors and we don’t know how use the vision sensor or how to program it.

There is a tourtoral in the Vexcode app.

Check out this STEM Lab:

And these Knowledge Base articles:


API is here (sensor commands & stuff):

If you're still confused about the sensor commands

If you are still confused about the sensor commands, add the vision sensor to your list of devices by clicking this button image in the upper right corner of the screen (I am assuming you’re using VEXcode v5 pro) and then adding the vision sensor. Then, select image and click “Command Reference” and then “Sensing”. Scroll down to where the vision sensor commands are, near the bottom. If you need help with any of those commands, right-click the command in the code and select “Command Help”.

The vision sensor has many uses, including but not limited to correcting angle in relation to a coloured object and detecting the largest object of a specific colour. This is highly useful for this year’s game, as the vision sensor can help you line up to the green flags above the goals and detect the colour of the balls.

Remember that in order to detect a colour, you must first configure the sensor to sense that specific colour.

Some code examples using the API are:

float width = Vision.objects[0].width;
bool exists = Vision.objects[0].exists;

Hope that helps, and good luck! :grin: