For a while I'm trying to get a MTRMX and a Lego Ultrasonic Sensor to work with a portsplitter, but I didn't succeed.
I read the port splitter concerning threads, but it didn't help.
Here is my code:
- Code: Select all
import lejos.nxt.*;
import lejos.nxt.addon.*;
public class MuxTest2 {
public static void main(String[] args) throws InterruptedException {
RCXMotorMultiplexer mux = new RCXMotorMultiplexer(SensorPort.S1);
UltrasonicSensor ultrasonicSensor = new UltrasonicSensor(SensorPort.S1);
while (!Button.ESCAPE.isPressed()) {
mux.setDirection(1,3);
Thread.sleep(10);
LCD.drawString(ultrasonicSensor.getDistance()+" ", 0, 4);
Thread.sleep(10);
}
}
}
The Ultrasonicsensor works properly, but the MTRMX doesn't work, only if the US Sensor is disconnected.
I tried to turn APDA on, but it didn't work.
The two devices have different i2c adresses, I have checked this.
What can I do?
PS: Sorry for my bad English, I'm German.
