A neat Arduino inspired library has come together over at Gordons Projects:
Wiring is the core of the input and output for the Arduino, so I thought it would be good to replicate that functionality (or a good usable subset) on the Raspberry Pi.
WiringPi is a Wiring library written in C and should be usable from C++ and many other languages with suitable wrappers.
WiringPi supports both an Arduino style pin numbering scheme which numbers the pins sequentially from 0 through 16, as well as the Raspberry Pi’s native BCM GPIO pin numbering scheme.
WiringPi normally uses a very low-level mechanism to access the underlying hardware – this results in very fast access, however the down-side is that your programs need to be run as root, so in addition to this, wiringPi has the ability to use the traditional /sys/class/gpio/ style interface, and if the GPIO pins have been exported and had their ownership changed appropriately, then applications using the wiringPi library, can be run without root privileges.
Some of the fancier library functions are:
- Serial port handling (both on-board and USB
- LCD Library
- Simplified threaded programming and process priority control
All of the library’s functions can be found here.
Check here for setting up the library and some other methods for running the Pi like an Arduino!