no, I mean two lamps. there're only this modes: String modes[] = {"Full", "Red", "Green", "Blue", "White", "None"};
and I've got an other problem now:
here are a few lines of my programm now:
- Code: Select all
import lejos.nxt.*;
import lejos.util.TextMenu;
public class allo {
static allo allr;
static int choice;
String colorNames[] = { "None", "Red", "Green", "Blue", "Yellow",
"Megenta", "Orange", "White", "Black", "Pink", "Grey",
"Light Grey", "Dark Grey", "Cyan" };
static String linienfarbe[] = { "Red", "Green", "Blue", "Yellow", "White",
"Black" };
String color;
ColorSensor cs;
public allo() {
cs = new ColorSensor(SensorPort.S3);
}
public static void main(String[] args) {
allr = new allo();
TextMenu Menu2 = new TextMenu(linienfarbe, 1, "Set color");
choice = Menu2.select();
if (choice < 0)
return;
allr.method();
}
public void method() {
LCD.clear();
LCD.drawString("choice: " + linienfarbe[choice], 0, 2);
while (true) {
color = colorNames[cs.getColor().getColor() + 1];
LCD.clear(3);
LCD.drawString("current:"+color, 0, 3);
if (color == linienfarbe[choice]) {
LCD.clear(4, 15, 1);
LCD.drawString("true", 11, 4);
;
} else {
LCD.drawString("false", 11, 4);
}
}
}
}
simple: if the colorsensor get the same color like <linienfarbe[choice]>, the nxt tells "true"
but it always tells "false"