Color Sensor and Motor info in RobotC

Hi everyone! I’m new here. I am running a HS Intro to Engineering w/ Robotics course, and chose VEX IQ because of its apparent ease of use and robust sensor / motor features.

I am wondering if much of the touted features on the VEX IQ product pages are not yet implemented in RobotC, or if I just don’t know where to look.

On the Color Sensor description page, it says that the sensor “Measures independent Red, Green, and Blue in 256 levels each”. Looking at the RobotC TextFunctions, I don’t see any way to get individual components from the color that it sees. Are there additional functions that are not in the TextFunctions window?

In addition, I’m not seeing a way to get the motor current, as described as a function on the SmartMotor page.

Am I doing something wrong as to not see some of these functions? Are they not implemented yet? Is there an in-depth guide that I’m missing?

Thanks for your help,

Chris

Hi Chris,

The ROBOTC Help File (Help menu > Open Help) file contains a lot of useful information, including the documentation and brief usage examples for accessing the advanced functionality of VEX IQ sensors and devices.

Inside the ROBOTC Help file, under Command Library - VEX IQ > Text-Based ROBOTC > ROBOTC - Color Sensor, you can see the documentation for many of the advanced color sensor features. The getColorBlueChannel(), getColorRedChannel(), and getColorGreenChannel() functions will return the 0…255 color values for their respective colors.

There are also functions to directly access the Smart Motor current sensor information. These four functions are:

getMotorCurrent(motor1) - Gets the immediate current in mA (0-4700).
getMotorCurrentLimit(motor1) - Gets the current limit setting in mA (0-4700)
setMotorCurrentLimit(motor1) - Sets the current limit setting in mA (0-4700)
getMotorCurrentLimitFlag(motor1) - Returns a logical “true” (1) if the current is above the current limit setting (flag directly from the motor).

The getMotorCurrent() function was accidentally omitted from the latest version of the ROBOTC Help File, and will be corrected soon.

Regards,

  • Art

Thanks, Art! That’s a big help! I’ll start trying it out tomorrow!