Unlike the RaspberryPi, to use the BananaPi board you must first configure the Pi4J library to use an alternate platform implementation.
There are three methods to configure the platform. You are free to use any of these three methods.
You can set the "PI4J_PLATFORM" environment variable to a value of "bananapi".
You can configure a Java system property named "pi4j.platform" to a value of "bananapi".
You can configure the platform in your Java code before you instantiate the Pi4J controller instance.
// #################################################################### // // since we are not using the default Raspberry Pi platform, we should // explicitly assign the platform as the BananaPi platform. // // #################################################################### PlatformManager.setPlatform(Platform.BANANAPI);
Pi4J uses an abstract pin numbering scheme to help insulate software from hardware changes.
Pi4J implements the same pin number scheme as the Wiring Pi project. More information about the WiringPi pin number scheme can be found here: http://wiringpi.com/pins/
Pi4J provides a BananaPiPin enumeration that is used to manage the accessible GPIO pins.
The BananaPi board contains a 26-pin expansion header labeled as 'CON3' providing access to 17 GPIO pins. The board also includes an 8-pin expansion header labled as 'J12' that provides an additional 4 GPIO pins.
(The CON3 and J12 headers are illustrated below)
The diagram below illustrates the GPIO pinout using the Pi4J/WiringPi GPIO numbering scheme.
The diagram below illustrates the GPIO pinout using the Pi4J/WiringPi GPIO numbering scheme.
A number of source code examples are provided to demonstrate the following capabilities/integrations: