Coder Social home page Coder Social logo

odroid.gpio's Introduction

HI

odroid.gpio's People

Contributors

hhk7734 avatar kilimnik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

maslinque

odroid.gpio's Issues

PWM

hey, do you have any plans to support PWM?
thanks for the library..

Ubuntu MATE okt 2022, does not install correctly with pip / setup.py

On latest version of Ubuntu Mate as of okt 2022, package does not install correctly on Odroid N2+ with pip, or setup.py

error: subprocess-exited-with-error
ERROR: failed building wheel for Odroid.GPIO
error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1
python setup.py bdist_wheel did not run succesfully

usage of dash-seperated 'long-description' will not be supported in future version, must change to underscore

image

ImportError: libwiringPi.so.3: cannot open shared object file: No such file or directory

I have a new Odroid C4 and some python code that was originally written for Raspberry Pi. I changed import RPi.GPIO to import Odroid.GPIO and followed the installation requirements from the readme.
I get stuck on on ImportError: libwiringPi.so.3: cannot open shared object file: No such file or directory.
Any suggestions?

From installation to ImportError

(venv) ebo@odroid:~/tools/network-anomaly-api/relay_API/API$ sudo add-apt-repository -y ppa:hardkernel/ppa \
> && sudo apt update
Hit:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease
Hit:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease
Hit:5 http://ppa.launchpad.net/hardkernel/ppa/ubuntu bionic InRelease
Hit:6 http://ppa.launchpad.net/hardkernel/ppa/ubuntu focal InRelease
Hit:7 http://archive.canonical.com/ubuntu focal InRelease
Get:8 http://deb.odroid.in/c4 focal InRelease [1714 B]
Fetched 1714 B in 2s (745 B/s)
Reading package lists... Done
Hit:1 http://archive.canonical.com/ubuntu focal InRelease
Hit:2 http://ports.ubuntu.com/ubuntu-ports focal InRelease
Hit:3 http://ppa.launchpad.net/hardkernel/ppa/ubuntu bionic InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
Hit:5 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease
Hit:6 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease
Hit:7 http://ppa.launchpad.net/hardkernel/ppa/ubuntu focal InRelease
Get:8 http://deb.odroid.in/c4 focal InRelease [1714 B]
Fetched 1714 B in 3s (579 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
4 packages can be upgraded. Run 'apt list --upgradable' to see them.
(venv) ebo@odroid:~/tools/network-anomaly-api/relay_API/API$ sudo apt install -y python3 python3-dev python3-pip \
>     odroid-wiringpi libwiringpi-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3 is already the newest version (3.8.2-0ubuntu2).
python3-dev is already the newest version (3.8.2-0ubuntu2).
python3-pip is already the newest version (20.0.2-5ubuntu1.8).
libwiringpi-dev is already the newest version (3.14.5-0~202301030313~ubuntu20.04.1).
odroid-wiringpi is already the newest version (3.14.5-0~202301030313~ubuntu20.04.1).
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
(venv) ebo@odroid:~/tools/network-anomaly-api/relay_API/API$ python3 -m pip install -U --user pip Odroid.GPIO
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
(venv) ebo@odroid:~/tools/network-anomaly-api/relay_API/API$ python3 -m pip install -U pip Odroid.GPIO
Requirement already satisfied: pip in /home/ebo/tools/network-anomaly-api/relay_API/venv/lib/python3.8/site-packages (23.0.1)
Requirement already satisfied: Odroid.GPIO in /home/ebo/tools/network-anomaly-api/relay_API/venv/lib/python3.8/site-packages (0.1.4)
Requirement already satisfied: pybind11>=2.4 in /home/ebo/tools/network-anomaly-api/relay_API/venv/lib/python3.8/site-packages (from Odroid.GPIO) (2.10.3)
(venv) ebo@odroid:~/tools/network-anomaly-api/relay_API/API$ cd ..
(venv) ebo@odroid:~/tools/network-anomaly-api/relay_API$ python3 app.py
Traceback (most recent call last):
  File "app.py", line 25, in <module>
    from web_app import app
  File "/home/ebo/tools/network-anomaly-api/relay_API/web_app/__init__.py", line 53, in <module>
    from web_app.relay.routes import relay_blueprint
  File "/home/ebo/tools/network-anomaly-api/relay_API/web_app/relay/routes.py", line 15, in <module>
    from API.relay import Relay
  File "/home/ebo/tools/network-anomaly-api/relay_API/API/relay.py", line 6, in <module>
    import Odroid.GPIO as GPIO
  File "/home/ebo/tools/network-anomaly-api/relay_API/venv/lib/python3.8/site-packages/Odroid/GPIO/__init__.py", line 29, in <module>
    from Odroid._GPIO import *
ImportError: libwiringPi.so.3: cannot open shared object file: No such file or directory
(venv) ebo@odroid:~/tools/network-anomaly-api/relay_API$

Change output() to set the value for each channel

def output(channels, values):
    '''
    Output to a GPIO channel or list of channels.
    channels - Pin number or list(pin number) according to the set mode.
    values   - value or list(value).
             - value can be 0/1 or False/True or LOW/HIGH.
    '''
    if not isinstance(channels, (list, tuple)):
        channels = [channels]

    if isinstance(values, (int, bool)):
        values = [values for _ in range(len(channels))]

    if len(values) != len(channels):
        raise RuntimeError("The number of channels and values are different")

    for i in channels:
        digitalWrite(i, values[i])

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.