I've a problem with the UltraSonic sensor on the NXT brick. When I call the method getDistance(), it always return me "255". I tried with a test program but it doesn't work...
I give you the code :
- Code: Select all
public class testDeplace{
public static void main(String [] args) throws Exception{
UltrasonicSensor ultra = new UltrasonicSensor(SensorPort.S4);
while(!Button.ESCAPE.isPressed()){
LCD.drawString("Distance : "+ultra.getDistance(), 1, 1);
}
}
}
Thanks to answer me.
eddynamique
