5

I'm setting up i2c for an Application written in C, but I've not been able to find any how-to's for it. I'm running a model-b Raspberry Pi on Debian 6 with LXDE. Can anybody show me how to set up i2c so I can use it in a C Application?

Thanks for any help in advance

5
  • In a month or two I need this too. Would be kind if I would find a how-to of you. Commented Feb 24, 2013 at 1:28
  • Sounds pretty good! Perhaps you could describe your actions? @ManuelSchneid3r Commented Feb 24, 2013 at 22:06
  • I want to write some cronjobs getting temperatures from TI sensors and save them in a db. php reads them out. In the end it is heating supervising rPi. Commented Feb 25, 2013 at 12:56
  • The Raspbian distro worked out of the box for me. I tried the Arch distro for Pi, but modprobe i2c-bcm2708 doesn't add anything to lsmod. The same command on Raspbian works, provided you remove it from the blacklist. If you can i2cdetect then your C program will work; otherwise, the drivers aren't set up properly. Commented Apr 3, 2013 at 18:27
  • All answers here are OUT-OF-DATE, and pretty much useless. Commented Mar 10 at 0:53

2 Answers 2

2

I've been looking for similar information and I found a couple of i2c tutorials, one in adafruit tutorials and the other in Guy Carpenter's Gaugette blog. I'm not yet at the stage of actually using it so I can't vouch for their completeness but they seem to be a good start.

Sign up to request clarification or add additional context in comments.

3 Comments

yeah, but how do I set up the libraries? That's my only trouble with this.
Updated with the "I2C installation" link I hope will help.
Note that the Analog Gauge article posted by TheDuke links to the following C code which illustrates the i2c library in use: gist.github.com/guyc/3735664
0

try this :

C GPIO Interface library for the Raspberry Pi

It offers API for handling GPIO port on Raspberry, including dedicated functions for I2C interface. I've been using this to read measurements from temperature sensor and it works perfect (STCN75 connected to RPi rev. B).

You can find examples and instructions on author's website. Project is maintained and updated frequently on public Git repo.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.