Is there a simple library to talk to i2c for C++? I have found some stuff for python and Java, but I wanted C++. I was hoping someone has ported the Arduino Wire library so I could use code I have already written for the Arduino. Thanks.
Tell me more
×
Raspberry Pi Stack Exchange is a question and answer site for
users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.
|
|
There's a i2c-dev header in the Linux userspace. I can't remember if this header is shipped with the lm-sensors package, or if it will need to be installed from source. I'd check your distro's package repository. xGoat has a nice article covering preparation & usage.
The source code for i2c-tools (download) are good examples in |
|||
|
|
|
There is a WiringPi which I think does exactly what you want. There are also wrappers for Pascal, Java, Python, Perl, TCL and Ruby. Additionally, someone might want to explore similar links: |
|||
|