Libraries for Raspberry Pi

Raspberry Pi Logo

When programming on any system, one should resist the NIH temptation. Not Invented Here.  There are plenty of free examples and libraries available for the Raspberry Pi and it is easier to use them instead of attempting to reinvent the wheel.

The following is a list why you may not want to use a pre-existing library.

  • No library exists in the language you are developing in for what you want to do.  At least you have not been able to find any.
  • You want to write your own library because you want to write your own library.  This could be because you wish to learn from the experience or because you really enjoy reinventing existing software.
  • The library you found does not support the features you need.
    • In this case, consider extending the library instead of rewriting it.
  • The feature you need is in the library but does not work properly.
  • The lack of documentation makes rewriting the library easier than trying to reverse engineer it.

The first thing that you need to consider when looking for a library to use is what programming language you will be developing in.  The primary language that the Raspberry Pi uses for development is Python.  That is where the PI in the name comes from.  It stands for Python Interpreter.  The Raspberry Pi is a full computer running a Linux operating system.  That means that you are not limited to using just Python.  Any programming language that can be used on Linux can be used for programming on the Raspberry Pi.

My preference is C++ and Java since I prefer to be able to write multi-threaded, object oriented code.  There is a library in Java for just that.  Pi4J is written in Java and uses JNI to make use of the WiringPi library in C.  In other words, the Pi4J library did not rewrite the code already written in WiringPi.  It makes use of the existing library and expands upon it.

Python Modules

  • Gpiozero
    A Python Module that provides an interface to the GPIO on a Raspberry Pi.
  • Gpiozero Documentation
    A PDF that provides the documentation for the gpiozero Python Module for accessing the GPIO on a Raspberry Pi.
  • Gpiozero: A Friendly Python API for Physical Computing
    The Python Module gpiozero was written after the RPi.GPIO Module. It provides a cleaner and simpler interface to accessing the Raspberry Pi GPIO.
  • RPi.GPIO
    RPi.GPIO is a Python Module or library that provides programming access to the GPIO on a Raspberry Pi.
  • RPi.GPIO Examples and Usage
    The RPi.GPIO is a Python Module that allows access to the GPIO on a Raspberry Pi. This wiki proves examples of using RPi.GPIO and information on using the module.

 

C/C++ Libraries

 

Java Libraries

  • Pi4J
    This project is intended to provide a friendly object-oriented I/O API and implementation libraries for Java Programmers to access the full I/O capabilities of the Raspberry Pi platform. This project abstracts the low-level native integration and interrupt monitoring to enable Java programmers to focus on implementing their application business logic
  • Raspberry Pi with Java 8 + PiJ4
    A presentations about Java library Pi4J. The presentation was presented by Robert Savage, Software Architect, MTS, Harman International.

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.