I have spent all day trying to write a program to drive forward until the color sensor detects a black line (using grayscale values), then stop. I am using the new RobotC Graphical programming. I have tried using the code on page 20 of the Introduction to Programming VEX IQ with ROBOTC4 Users Guide, and I have tried my own version. Nothing works correctly.
If the color sensor is in the default port 9, the sensor will not turn on the LED light, and the sensor will not control the motors. It does see values, and I can see them in the sensor view pane during the debug process. The values do change when I move the sensor over different colors.
If the color sensor is in a different port (port 2, for example), the LED light will turn on, but the sensor will still not control the motors.
I did get the color sensor to work correctly in port 9 using the “Basic Line Track Left” function (sensor mounted under chassis about 1/4 inch above table). The light turns on, and detects black, and runs the motors. I did get the color sensor to detect the line using “GetColorHue” in port 9, mounting the sensor about 3 inches above the table. The hue function doesn’t use the LED light.
How can I get the sensor to turn on the LED light and stop at a black line using grayscale values? What am I doing wrong?