Orange Pi Zero GPIO Programming using JAVA

Orange Pi Zero GPIO

Orange Pi Zero GPIO ProgrammingThis is a simple tutorial on Orange Pi Zero GPIO Programming using JAVA. For this, I have used Pi4J library which also works with Raspberry Pi. This tutorial might help you to interact with GPIO in your IOT projects. In his tutorial, I have tested the application with LUBUNTU OS on Orange Pi Zero.





import com.pi4j.platform.Platform;
import com.pi4j.platform.PlatformAlreadyAssignedException;
import com.pi4j.platform.PlatformManager;

public class Mainclass {

    public static void main(String[] args) throws InterruptedException, PlatformAlreadyAssignedException {

    	System.out.println("Starting Demo");
        PlatformManager.setPlatform(Platform.ORANGEPI); // Support for Orange Pi

        final GpioController gpio = GpioFactory.getInstance();

        GpioPinDigitalInput inputPin = gpio.provisionDigitalInputPin(OrangePiPin.GPIO_00,PinPullResistance.PULL_UP);// Pulled UP
        GpioPinDigitalOutput outputPin = gpio.provisionDigitalOutputPin(OrangePiPin.GPIO_07);
        if(inputPin.isLow()){// Checks if switch is pressed.

        	System.out.println("Switch is pressed.");
       // gpio.shutdown();


A simple java application to access GPIO of Orange Pi Zero using Pi4J and JAVA.

0 forks. 1 stars. 0 open issues.

Last commit by

Connection Diagram:
Orange Pi Schematic
Orange Pi Schematic
Buy Orange Pi Zero:
Catch Me On

Bikash Panda

Blogger / Embedded System Developer at WGLabz
A techie, tinkerer and tech lover, who loves to blog and feels everyone can learn tech provided they have the right attitude towards learning and passion. By profession, I am an IOT developer working in Smart Home/ Smart Grid domain.
Bikash Panda
Catch Me On

Latest posts by Bikash Panda (see all)