4

Does Raspbian come out of the box with some GPIO library for C, or if not, does it have any in the standard repository?

Sure I could just download and compile any of the libs on my own from .tgz but then I lose auto-updates and the likes, so I thought I'd ask first.

SF.
  • 920
  • 1
  • 8
  • 21

3 Answers3

3

If you are looking for something comparable to Arduino, consider looking at WiringPi. WiringPi is an Arduino wiring-like library written in C and released under the GNU LGPLv3 license. The code example looks very similar to code written for the Arduino.

You could also take a look at the bcm2835 library. The example code looks pretty simple.

Just some extra suggestions to those already out there.

syb0rg
  • 8,178
  • 4
  • 38
  • 51
2

There is a Python GPIO library in the package repository of Raspbian, but no C or any other counterpart at this time.

You can search for them yourself my typing:

$ apt-cache search gpio

If you understand how the GPIO works, you will notice that you can access the main functions using the file system mapping, just by reading and writing into files in the file system. This option is auto-updated together with the kernel and modules.

You can always use direct register access to use the GPIO, as described in the elinux RPi Low Level page, but I don't think that would help you achieve your objective though.

syb0rg
  • 8,178
  • 4
  • 38
  • 51
Marco Poli
  • 1,871
  • 10
  • 21
0

i program in python however i believe a quick google search of

WiringPi 

should provide you with what you need plus some very useful extras such as software pwm etc.

D Mason
  • 135
  • 1
  • 11