How to code a VEX Vision Sensor

Hey. We encountered a problem. That problem is that we don’t know how to attach the code of our coded vision sensor to our coded robot. Please lend us some assistance.

#1 rule of asking for code help is to always post your code. We can’t help you if we don’t know what you’re doing.
#2 Always format it.


Have you already checked out programming tutorial in the Play section of V5 knowledge base guide for Vision Sensor?

Also, there are instructions on how to setup and use signatures as well as code example here:


We’re gonna do this together, we’re gonna stick to the plan, do everything we can, to make it easy and fun. It’s time to potty everyone. I’m a big kid now!


We are trying to make it so that whenever the sensor detects a color, a motor stops moving for the duration of the color. The code that we have right now is,

if (visionsensor.objects.exists) {

This just makes the vision sensor stop the duration of the driving period, whether there is a ball or not. All of the coding lessons for the vision sensor that we can find on the internet involve coding it with block code, whereas we are trying to code it with “text code.”