Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   adxl345 demo (http://www.chiefdelphi.com/forums/showthread.php?t=119327)

fovea1959 15-09-2013 21:55

adxl345 demo
 
working on sensors off season.

trying to read one of the KOP ADXL345, connected via I2C.

Doing

this.adxl345_i2c = new ADXL345_I2C(1, ADXL345_I2C.DataFormat_Range.k2G);

then

adxl345_i2c.getAcceleration(ADXL345_I2C.Axes.kX)

getting consistent 0 results back on all three axes.

obvious programming booboo, bug in WPILIB, or do I need to start checking wiring (sidecar cable, etc)???

cgmv123 15-09-2013 23:04

Re: adxl345 demo
 
We've never had much success with the WPI accelerometer class. This alternate was written last year, but I don't think it was ever tested. https://github.com/team1306/Badgerbo...erometer2.java

Mike Bortfeldt 16-09-2013 09:58

Re: adxl345 demo
 
Try setting "SetCompatibilityMode(true)" on the i2c object. That may help.

Mike

fovea1959 29-09-2013 13:35

Re: adxl345 demo
 
Max, Mike, thanks. I didn't try it without setting compatibility mode

I'm getting sensible data out, the sum of the squares of the 3 axes is pretty constant, regardless of orientation.

Need to read the data sheet to see what I'm looking at for units.

...and also a nice example of interfacing arbitrary I2C devices.


All times are GMT -5. The time now is 11:35.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi