by nate » Sun Oct 30, 2011 12:37 am
Thanks Aswin. The only thing missing is your nl.totan.util.Formatter, which I assume formats floating point numbers ala printf?
Also, why did you do the following:
SensorPort.S4.i2cEnable(I2CPort.HIGH_SPEED);
DIMUAccel accel = new DIMUAccel(SensorPort.S4);
DIMUGyro gyro = new DIMUGyro(SensorPort.S4);
public DIMUGyro(I2CPort port) {
super(port, I2C_ADDR, I2CPort.LEGO_MODE, I2CPort.TYPE_LOWSPEED);
You set the port to HIGH_SPEED, and then change it to LEGO_MODE in the constructor? Also, I wrote my own driver, and I had a of issues with it not accepting configuration values without some delays after starting up, and I noticed you're not checking the results from sendData().
// put in sleep mode;
sendData(CTRL_REG1, (byte)0x08);
When I do something like this, I keep getting errors.
// Finally, enable the gyro on all axes, and disable power-down
if (sendData(CTRL_REG1, (byte)0x0F) != 0)
throw new RuntimeException("Unable to enable gyro");
Nate