Data Sheet
Core Spartan Documentation Modern Robotics, Inc
Version 3.0.3 Page 57
CORE_COLOR_SENSOR(int address)
Save the I2C address for future reads and writes. This must be done before
setup().
CORE_COLOR_SENSOR colour;
…or…
CORE_COLOR_SENSOR colour(0x1E);
void colorSetup(char mode, int rate)
This function sets the mode and rate at which the readings are taken. The mode
can be either active or passive. In active mode, the white LED on the sensor is
used to illuminate the surface that it is trying to detect. Active mode works best
when the sensor is looking at an object at a slight angle so that the white light is
not picked up by the sensor thus distorting the readings. In passive mode, the
sensor takes readings without the use of the white LED. Passive mode works best
for detecting colored light much like that produced by the COLOR BEACON
sensor. The rate sets the operational frequency of the sensor that can be either
50Hz or 60Hz. The purpose of this is to eliminate any flickering from ambient
light. This function must be called first when setting up the COLOR_SENSOR
sensor.
colour.colorSetup(colour.ACTIVE, colour.FIFTY);
…or…
colour.colorSetup(colour.PASSIVE, 60);
void blackBalance(void)
This function gathers data and calculates an average value for each of the three
color channels. To calibrate the black balance, point the sensor so that there is
no object within 5 feet (1.5m) forward of the sensor. Calibration takes
approximately 1.5 seconds. This function must be called before the
whiteBalance() function because the white balance calculations are dependent
on the black balance values.
colour.blackBalance();










