View: 12945|Reply: 13

GPIO not working on OrangePi Win Plus with Python

[Copy link]

1

threads

5

posts

34

credits

Novice

Rank: 1

credits
34
Published in 2018-4-13 02:56:43 | Show all floors |Read mode
Edited by nishant at 2018-4-13 02:59

Hello every one I'm new to this site and I have recently purchased an Orange Pi Win Plus but got a lot of issues in configuring it.
I'm now able to blink LED through Shell and C with WiringPi but I couldn't find any working Python 3 based Library for GPIO.

I installed WiringPi from : https://github.com/OrangePiLibra/WiringPi

This actually helped me to access GPIO through C/C++ and Shell but I couldn't find any thing for Python that's working.

I came accross a new Python Library : "pyA64" but its not working. Also, the library "OPi.GPIO" doesn't supports my Board.
I also tried this : https://github.com/lanefu/WiringPi-Python-OP
but that's makes my "gpio" command to stop functioning.

I need help!!
Does anyone knows how to access GPIO on Orange Pi Win Plus through Python ?


10

threads

218

posts

2040

credits

Gold member

Rank: 6Rank: 6

credits
2040
Published in 2018-4-18 07:54:10 | Show all floors
Edited by nopnop2002 at 2018-4-18 07:57
nishant replied at 2018-4-17 23:39
Even that didn't worked on mine. This is my output :
>>> from periphery import GPIO
>>> gpio_out = ...

sudo sh -c "echo 227 >/sys/class/gpio/export"


Is there /sys/class/gpio/gpio227 ??



10

threads

218

posts

2040

credits

Gold member

Rank: 6Rank: 6

credits
2040
Published in 2018-4-14 04:10:14 | Show all floors
Edited by nopnop2002 at 2018-4-14 08:27
nishant replied at 2018-4-14 03:47
This is my GPIO configuration on OrangePi Win Plus :

$ gpio readall

BCM is GPIO#.

  1. from periphery import GPIO

  2. gpio_out = GPIO(227, "out")

  3. gpio_out.write(1)

  4. gpio_out.close
Copy code


Pin#3 is set as 1.

10

threads

218

posts

2040

credits

Gold member

Rank: 6Rank: 6

credits
2040
Published in 2018-4-13 21:31:28 | Show all floors
Edited by nopnop2002 at 2018-4-13 21:57

If you know /sys/class/gpio allocation about Orange Pi Win Plus, try this.

https://github.com/vsergeev/python-periphery


  1. from periphery import GPIO

  2. gpio_out = GPIO(12, "out")

  3. gpio_out.write(1)

  4. gpio_out.close()
Copy code



/sys/class/gpio/gpio12 set to 1.

I don't know /sys/class/gpio allocation about Orange Pi Win Plus.




1

threads

5

posts

34

credits

Novice

Rank: 1

credits
34
 Author| Published in 2018-4-14 03:40:08 | Show all floors
nopnop2002 replied at 2018-4-13 21:31
If you know /sys/class/gpio allocation about Orange Pi Win Plus, try this.

https://github.com/vserg ...

That's not working at all I'm getting below error:

>>> from periphery import GPIO
>>> gpio_out = GPIO(1, "out")
OSError: [Errno 517] Unknown error 517

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/periphery/gpio.py", line 89, in _open
    f_direction.write(direction + "\n")
OSError: [Errno 517] Unknown error 517

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/periphery/gpio.py", line 43, in __init__
    self._open(pin, direction)
  File "/usr/local/lib/python3.5/dist-packages/periphery/gpio.py", line 91, in _open
    raise GPIOError(e.errno, "Setting GPIO direction: " + e.strerror)
periphery.gpio.GPIOError: [Errno 517] Setting GPIO direction: Unknown error 517
>>>

1

threads

5

posts

34

credits

Novice

Rank: 1

credits
34
 Author| Published in 2018-4-14 03:47:45 | Show all floors
This is my GPIO configuration on OrangePi Win Plus :

$ gpio readall

+-----+-----+----------+------+---+-Orange Pi Win/Win+ +---+---+------+---------+-----+--+
| BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
+-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
|     |     |     3.3v |      |   |  1 || 2  |   |      | 5v       |     |     |
| 227 |   8 |    SDA.1 |   IN | 0 |  3 || 4  |   |      | 5V       |     |     |
| 226 |   9 |    SCL.1 | ALT5 | 0 |  5 || 6  |   |      | 0v       |     |     |
| 362 |   7 |   GPIO.7 |   IN | 0 |  7 || 8  | 0 | OUT  | S_TX     | 15  | 354 |
|     |     |       0v |      |   |  9 || 10 | 1 | OUT  | S_RX     | 16  | 355 |
| 229 |   0 |     RxD3 |   IN | 0 | 11 || 12 | 0 | OUT  | GPIO.1   | 1   | 100 |
| 228 |   2 |     TxD3 |   IN | 0 | 13 || 14 |   |      | 0v       |     |     |
| 231 |   3 |     CTS3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO.4   | 4   | 361 |
|     |     |     3.3v |      |   | 17 || 18 | 0 | IN   | GPIO.5   | 5   | 68  |
|  98 |  12 |     MOSI |   IN | 0 | 19 || 20 |   |      | 0v       |     |     |
|  99 |  13 |     MISO |   IN | 0 | 21 || 22 | 0 | IN   | RTS3     | 6   | 230 |
|  97 |  14 |     SCLK |   IN | 0 | 23 || 24 | 0 | IN   | CE0      | 10  | 96  |
|     |     |       0v |      |   | 25 || 26 | 0 | IN   | GPIO.11  | 11  | 102 |
| 143 |  30 |    SDA.2 |   IN | 0 | 27 || 28 | 0 | IN   | SCL.2    | 31  | 142 |
|  36 |  21 |  GPIO.21 |   IN | 0 | 29 || 30 |   |      | 0v       |     |     |
|  37 |  22 |  GPIO.22 |   IN | 0 | 31 || 32 | 0 | IN   | RTS2     | 26  | 34  |
|  38 |  23 |  GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v       |     |     |
|  39 |  24 |  GPIO.24 |   IN | 0 | 35 || 36 | 0 | IN   | CTS2     | 27  | 35  |
| 101 |  25 |  GPIO.25 |   IN | 0 | 37 || 38 | 0 | IN   | TxD2     | 28  | 32  |
|     |     |       0v |      |   | 39 || 40 | 0 | IN   | RxD2     | 29  | 33  |
+-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
| BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
+-----+-----+----------+------+---+-Orange Pi Win/Win+ +---+------+----------+-----+-----+

1

threads

5

posts

34

credits

Novice

Rank: 1

credits
34
 Author| Published in 2018-4-17 23:39:59 | Show all floors

Even that didn't worked on mine. This is my output :
>>> from periphery import GPIO
>>> gpio_out = GPIO(227, "out")
>>> gpio_out.write(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/periphery/gpio.py", line 144, in write
    raise TypeError("Invalid value type, should be bool.")
TypeError: Invalid value type, should be bool.
>>>
>>>
>>>
>>> gpio_out.write(true)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'true' is not defined
>>> gpio_out.close
<bound method GPIO.close of <periphery.gpio.GPIO object at 0x7fa7657908>>
>>>


So I'm sill stuck !!


10

threads

218

posts

2040

credits

Gold member

Rank: 6Rank: 6

credits
2040
Published in 2018-4-22 09:27:30 | Show all floors
nishant replied at 2018-4-17 23:39
Even that didn't worked on mine. This is my output :
>>> from periphery import GPIO
>>> gpio_out = ...

sudo sh -c "echo 227 >/sys/class/gpio/export"


Is there /sys/class/gpio/gpio227 ??

0

threads

112

posts

322

credits

Intermediate member

Rank: 3Rank: 3

credits
322
Published in 2022-4-1 09:55:22 | Show all floors
Exceptional article, gone ahead of time along with added your blog. My spouse and i can’t delay you just read additional via anyone.        Packers and Movers Kanpur

0

threads

332

posts

914

credits

Senior member

Rank: 4

credits
914
Published in 2023-12-11 04:10:27 | Show all floors
구글 seo thrives when your website is responsive, adapting seamlessly to various devices and screen sizes.
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list