I managed to test the motors , it was simple indeed to create a new instance with MotorPort.A and sending the forward() method.
But however ColorSensor buzzed me a lot.
Here is the simple code I produced:
- Code: Select all
import lejos.nxt.*;
public class ColorTest {
/**
* @param args
*/
public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
ColorSensor colorSensor = new ColorSensor(SensorPort.S1);
// SensorPort.S1.activate();
while (true){
// colorSensor.getData(0x41, new byte[3], 4);
LCD.drawString("Green: "+colorSensor.getGreen(), 2, 2);
LCD.refresh();
Thread.sleep(200);
LCD.clear();
}
}
}
When I upload it via Eclipse the LCD always prints out : 255
The fog light of the sensor is ON. But I was expecting to get results other than 255 .
Could you lead me?
Thank you.
