Today’s effort was trying to get the I2C working on the RoboRIO. Evidently, the on-board I2C port is /dev/i2c-2 (that’s the 3rd port of 3). We wanted to get a generic example of I2C code that could be extended to use any of the dozens of I2C sensors available from places like Sparkfun.
We first got a Linux only program running to prove the port was working at all. Then we ported the application to WPILib. The device was a Sparkfun ADXL345 3-axis accelerometer. Anyone interested in the code is welcome to a copy of both the Linux version and the WPILib version.
Drop by https://www.facebook.com/FRC2015ControlsBeta for a look at the hook up.
We would be interested in the code. do you have a link?
Did you experience any issues with this? Trying to get info on it, not helping. Also, how did you find the addresses for it all. Like knowing to send to port 16 ect.
I’m sorry, I don’t understand what you’re asking here. The code is available from the link listed earlier in this thread.
You can see a picture of how it was connected at Redirecting... . Note that this is the Sparkfun ADXL345 board – not the one found in previous KoP deliveries! For the KoP sensor, use the provided WPILib classes. Our I2C example code was just a way to demonstrate I2C on the RoboRIO from start to finish.
HTH
Here is a copy for posterity.
HTH,
Mike
ADXL-I2C.zip (1.7 MB)
ADXL-I2C.zip (1.7 MB)
You can pick it up from the message just above it where I attached the zip file to the message.
HTH,
Mike
This year, the ADXL345_I2C class was updated to take alternate address, like the Sparkfun board uses. Is there another reason the WPILib classes don’t work?
There shouldn’t be. But, I haven’t revisited this with the 2016 WPILib as of yet. If it works out of the box, please post that so others will benefit as well.
Thanks,
MikeA