Skip to content
/ OPIGPIO Public

A Python package for working on Orangepi PC gpio. The package offers an Arduino-like API and is designed for ease of use.

Notifications You must be signed in to change notification settings

Jss-on/OPIGPIO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

OPIGPIO: A Python Package for GPIO on Orange Pi

OPIGPIO is a Python package designed to simplify GPIO (General Purpose Input/Output) operations on Orange Pi. The package offers an Arduino-like API and is designed for ease of use.

Features

  • Easy-to-use API similar to Arduino.
  • Automatic permission handling for non-root users.
  • Comprehensive logging for debugging.

Installation

Local Installation

git clone https://github.com/Jss-on/OPIGPIO.git
cd OPIGPIO
pip install .

Installation from PyPI

pip install OPIGPIO

Usage

Here's a quick example that shows how to make an LED blink connected to pin 12:

import time
import logging
from OPIGPIO.opi_gpio import OPIGPIO

# Initialize logging
logging.basicConfig(level=logging.INFO)

# Initialize the GPIO class
gpio = OPIGPIO()

# Run any setup code
gpio.setup()

# Set the mode of pin 12 as output
gpio.pinMode(12, "out")

# Loop to make the LED blink
while True:
    gpio.digitalWrite(12, 1)  # Turn the LED on
    time.sleep(1)             # Wait for 1 second
    gpio.digitalWrite(12, 0)  # Turn the LED off
    time.sleep(1)             # Wait for 1 second

Security Note

This package includes the ability to change file permissions to allow GPIO operations for non-root users. Please be aware that this has security implications and should only be used in trusted environments.

About

A Python package for working on Orangepi PC gpio. The package offers an Arduino-like API and is designed for ease of use.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages