I'm trying to use the ultrasonic sensor from iCommand, but I keep getting errors. Do you need to initialize the sensor before using it?
Here's my code:
import icommand.platform.nxt.*;
public class Test{
public static void main(String[] args){
Ultrasonic sensor = new Ultrasonic(Sensor.S4);
System.out.println(sensor.getSensorType());
while (true)
System.out.println("Distance: " + sensor.getDistance());
}
}
Here's the errors:
Looking for 'icommand.properties' in working dir: /Users/riki/Develop/icommand-0.5/samples
NXTCOMM = /dev/tty.RikiBot-DevB-1
Experimental: JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
RXTX Warning: Removing stale lock file. /var/lock/LK.003.010.000
NXTCommand.LSGetStatus() error: Specified channel connection not configured or busy
NXTCommand.LSGetStatus() error: Pending communication transaction in progress
Sonar
NXTCommand.LSGetStatus() error: Pending communication transaction in progress
No bytes to be read in I2CSensor.getData(). Returning 0.
Distance: 0
NXTCommand.LSGetStatus() error: Pending communication transaction in progress
No bytes to be read in I2CSensor.getData(). Returning 0.
Distance: 0
NXTCommand.LSGetStatus() error: Pending communication transaction in progress
No bytes to be read in I2CSensor.getData(). Returning 0.
Distance: 0
...
Thanks,
-Rich-

