Hi,
I have recently embarked on an adventure into the programming world and am a 'newby' to java. Am trying to get 'my robot' to recgonise the difference between 'blue' and 'red', and execute commands - My program so far is the following - it's not recgonising the colour difference. Help pleeeasssee
import lejos.nxt.*;
public class colourTest
{
public static void main(String[] args)
throws Exception
{
LightSensor light = new LightSensor(SensorPort.S1);
Motor.A.setSpeed(160);
while(light.readValue() > 475 && < 485)
{
Motor.A.backward();
Motor.B.stop();
Motor.C.stop();
Thread.sleep(1000);
}
if(light.readValue() > 375 && < 385)
{
Motor.A.forward();
Motor.B.stop();
Motor.C.stop();
Thread.sleep(1000);
}
else
Motor.B.backward();
Motor.C.backward();
Thread.sleep(2000);
}
}