i have problem with using ProximitySensor class, here is the code:
- Code: Select all
import josx.platform.rcx.Motor;
import josx.platform.rcx.Sensor;
import josx.platform.rcx.ProximitySensor;
import josx.platform.rcx.LCD;
import josx.platform.rcx.TextLCD;
public class Proximity {
public static void main (String[] args) throws InterruptedException {
ProximitySensor ps2 = new ProximitySensor (Sensor.S2);
Motor.A.forward ();
Motor.C.forward ();
ps2.waitTillNear (0);
LCD.clear();
TextLCD.print ("dupa");
Motor.C.backward ();
Thread.currentThread ().sleep (3000);
Motor.A.stop ();
Motor.C.stop ();
}
}
my point was that robot should run forward, when object appears it should rotate and stop, but all it do is rotate even if nothing is in its way
Edit: please can someone at least post any working example that uses ProximitySensor Class.
I'm using lejos 2.1.0 can it be a problem, should i upgrade to newer version?
