I'm currently writing on a program about detecting different colored balls and sorting them with the Lego NXT and its color sensor. At the beginning it worked quite good but now, the color sensor always returnes the color ID "7" (white), no matter what i do.
On the documentation page i found something about a calibration (calibrateHigh() and calibrateLow()). Does anybody know how to use this calibration or is my color sensor broken?
I tried it with this code:
package com.mydomain;
import lejos.nxt.*;
public class HelloWorld {
public static void main(String[] args) throws Exception {
ColorSensor color = new ColorSensor(SensorPort.S2);
while (true) {
LCD.drawInt(color.getColorID(), 1, 1, 1);
}
}
}