I work on Segway-like robot and have found that UltrasonicSensor sometimes hangs. I cannot reproduce it by using some simple code, but I found that the problem occurs more frequently when I use remote control via Bluetooth.
I found that the execution hangs on the line
Code: Select all
i2cEvent.waitEvent(I2C_IO_COMPLETE << iPortId, NXTEvent.WAIT_FOREVER);
in i2cTransaction method of SensorPort.
It seems that the problem is in VM code.
I use two i2c sensors in my project but only UltrasonicSensor sensor hangs. LeJOS revision is 5926.
The source code can be found in http://dl.dropbox.com/u/13076168/NXJWay.zip. As a remote controller I use a game pad with the NXTGamePad program from nxtOSEK http://lejos-osek.sourceforge.net/nxtgamepad.htm.