I'm a new to VEX IQ and I'm having trouble programming for color sensors?

So I’ve been trying this forever now and I am trying to program so that the robot moves towards a colored object. I am trying to get the robot to grab blue balls. I program off of Modkit and I can’t seem to get the program correct. I’m frustrated but nonetheless I will keep trying. This is what my program looks like now. I am trying to get the robot to approach blue balls only and grab them and dump them somewhere specific. I had it working before on another program but now I can’t remember what I did.


Here’s where I am at so far…

Sorry… no modkit XP, we use robotC.

Ok, I am trying robotC now at the moment. I am still getting used to the motors and I am trying to program sensors now. My motors are working well, but I still need to perfect the program far more than it is now. How would you program color sensors on robotC.


There are sample programs in RobotC under the File > Open Sample Programs menu that show how to use the various color and greyscale features of the Color Sensor.


  • Art

Here is a video with an example that uses the color sensor. When the robot detects the color red on the mat, it stops. https://www.youtube.com/watch?v=A8urJvD2RrE

I introducing VexIQ this year to my robotics club and

on ModKit I’m trying to get my clawbot to

go forward
go turn back when black detected black line.

I’ve atttatched what I’ve got so far. I haven’t really detected any movement at all.

I realized now that I may need to put a forever loop around the entire script after “start.” Also, adjust my colour sensor values (but I should still see movement FWD or REV). But could someone please show me an example of a script that works and does this? Or give me suggestions?

I’ll have access to the robot tomorrow. I hope I can get an answer by then.


Yes, you will need the forever loop, after the start block. With this program, the motor may get a command to start, but will stop when the program ends, which happens right away.

With this program, if you start the robot on the line, it should move for 1 second.