Giter Site home page Giter Site logo

orangepi.gpio's Introduction

OrangePi.GPIO

This is a modified version of RPi.GPIO for Orange Pi Boards.

It is based on the original RPi.GPIO.

Installation

With PIP

sudo pip install OrangePi.GPIO

Manual

sudo apt-get update
sudo apt-get install python-dev git
git clone https://github.com/Jeremie-C/OrangePi.GPIO
cd /OrangePi.GPIO
sudo python setup.py install

Supported Boards

  • OPi ZERO
  • OPi ZERO PLUS
  • OPi ZERO PLUS2 H3
  • OPi ZERO PLUS2 H5
  • OPi R1
  • OPi PC & PC PLUS
  • OPi ONE
  • OPi LITE
  • OPi PC2
  • OPi PRIME

Usage

Same as RPi.GPIO but with a new function to choose OrangePi Board.

import OPi.GPIO as GPIO
GPIO.setboard(GPIO.ZEROPLUS)
GPIO.setmode(GPIO.BOARD)
GPIO.output(5, 1)

Many demo is on the example folder

orangepi.gpio's People

Contributors

jeremie-c avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

orangepi.gpio's Issues

Pin#11 and Pin#13 of orangepi_zero_plus2_H3 don't work.

Thank you for useful tool.

Pin#11 and Pin#13 of orangepi_zero_plus2_H3 don't work.
This address doesn't continue.

import OPi.GPIO as GPIO
from time import sleep          # this lets us have a time delay
pin = 11

GPIO.setboard(GPIO.ZEROPLUS2H3) # Orange Pi ZERO Plus H3 board
GPIO.setmode(GPIO.BOARD)        # set up BOARD BCM numbering
GPIO.setup(pin, GPIO.OUT)       # set BCM7 (pin 26) as an output (LED)

try:
    print ("Press CTRL+C to exit")
    while True:
        GPIO.output(pin, 1)     # set port/pin value to 1/HIGH/True
        sleep(0.1)
        GPIO.output(pin, 0)     # set port/pin value to 0/LOW/False
        sleep(0.1)

        GPIO.output(pin, 1)     # set port/pin value to 1/HIGH/True
        sleep(0.1)
        GPIO.output(pin, 0)     # set port/pin value to 0/LOW/False
        sleep(0.1)

        sleep(0.5)

except KeyboardInterrupt:
    GPIO.output(pin, 0)         # set port/pin value to 0/LOW/False
    GPIO.cleanup()              # Clean GPIO
    print ("Bye.")

issue when using add_event_detect

I have encountered a problem when using
GPIO.add_event_detect(channel)
on an orangepi zero

As soon as i use this function, the GPIO.input(channel) is random and static
The interrupt is working, but i cannot read the input any longer with the actual value, instead i get a constant 0 or a constant 1, but this seems to endependent of the input-state.
The PullUp is still active and even the Pin is no output - i just get no actual value.
If i skip the add_event_detect i can read the actual value of the pin.

when add_event_detect is not used, there is no entry for this gpio in /sys/class/gpio
when add_event_detect is used, there is an entry for this gpio in /sys/class/gpio and value shows the correct pin state - so low driver seems to work...

when add_event_detect is used, a "gpio readall" on a second terminal gives the correct value

linux is the latest armbian-ubuntu image Armbian_5.69_Orangepizero_Ubuntu_bionic_next_4.19.13.img
pip list shows i have OPi.GPIO 0.3.6

test.zip

Can't import module

Hello @Jeremie-C

root@OrangepiZero:/# pip list
Package       Version
------------- -------
OrangePi.GPIO 0.6.3
pip           18.0
setuptools    40.2.0
wheel         0.31.1
root@OrangepiZero:/# python
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import OPi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named OPi
>>> import OPi.GPIO
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named OPi.GPIO
>>> import OPi.GPIO as GPIO
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named OPi.GPIO

I notice that i have only one file in the OrangePi.GPIO folder:

root@OrangepiZero:/# ls -a /usr/local/lib/python2.7/dist-packages/OPi
.  ..  GPIO.so

What's wrong?

Thanks

I can't choose the board name

I can't choose the board name
GPIO.setboard(GPIO.PC&PCPLUS)
GPIO.setboard(GPIO.ONE)
GPIO.setboard(GPIO.LITE)
An error message appears:
AttributeError: module 'OPi.GPIO' has no attribute 'ONE'

Thank you !

Channel remains in use

After using a python module with OPi GPIO (in this case risingfalling.py) and when the program is terminated using Ctrl-C, I get the following error when I try to run it again:

user@pizero2:~/example$ sudo python risingfalling.py
Traceback (most recent call last):
File "risingfalling.py", line 14, in
GPIO.setup(23, GPIO.IN) # set GPIO25 as input (button)
ValueError: This channel is already in use by system as SEE_MANUAL.

I cannot use pip to install this

fatal error: Python.h: No such file or directory
#include "Python.h"
^~~~~~~~~~
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

I use Orange Pi Pc with Armbian Bionic (mainline based kernel 5.3.y)

Convert to H6 (64bit)

I'm working on OPi Lite 2 (H6, 64-bit based) board and trying to port this code into H6 env. However, no luck so far. I've modified the base addresses to match H6. However, cannot get the designated GPIO pin to work. I tried reading back the port control register, but always got 0x0 value, even the default value, according to the DS, should be 0x7777_7777 or any non-zero value. I'm wondering if this has to do with the 32-bit addressing vs 64-bit. Can anyone point me how to proceed? Really appreciated!

Support for Orange Pi 3

This library does not seem to support Orange Pi 3 or Orange Pi 4 versions, which are fairly new. Does anyone know if any of the setup options works for Orange Pi 3? or if there will be support for this board any time soon?

It's a shame since both of these boards are pretty powerful and it would be nice to be able to control the GPIO pins.

Type mistake

Thank you for nice tool!!

There is Type mistake in README.md.
cd /OrangePi.GPIO ---> cd OrangePi.GPIO

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.