How can I print the string value of the scanned color on the NXT-Screen? My code currently looks like this:
ColorSensor colorSensor = new ColorSensor(SensorPort.S4);
ColorSensor.Color color = colorSensor.getColor();
System.out.println("Color = " + colorSensor.getColorID() + " " + color.getColor());
It only prints out the number of the color twice, but I want it to print "red" or "blue" and so on. Is this possible?
Well, you can't really print "Red" or "blue" out. Each color has a number.
Here is the example of my other answer (click here):
So you have to make your own method to print out which color it is.
Click here if you want to see the constants of the colors