Репка / Repka-Pi

  • Автор темы Репка / Repka-Pi
  • Дата начала
File "gpio8.py", line 4, in <module>
GPIO.setboard(GPIO.PC2)
AttributeError: module 'OPi.GPIO' has no attribute 'setboard'


SUNXI:

root@Repka-Pi:~/gpio-test# python3 gpio8.py
Traceback (most recent call last):
File "gpio8.py", line 12, in <module>
GPIO.setup(11, GPIO.OUT)
File "/usr/local/lib/python3.8/dist-packages/OPi/GPIO.py", line 470, in setup
pin = get_gpio_pin(_mode, channel)
File "/usr/local/lib/python3.8/dist-packages/OPi/pin_mappings.py", line 80, in get_gpio_pin
return _pin_map[mode][channel]
File "/usr/local/lib/python3.8/dist-packages/OPi/pin_mappings.py", line 14, in getitem
offset = ord(value[1]) - 65
TypeError: 'int' object is not subscriptable


Может я номер как-то не так задаю?


https://github.com/Jeremie-C/OrangePi.GPIO/issues/7
 


#!/usr/bin/env python
# -*- coding: utf-8 -*-

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

GPIO.setboard(GPIO.PC2) # Orange Pi PC board
GPIO.setmode(GPIO.BOARD) # set up BOARD BCM numbering
GPIO.setup(PA8, GPIO.OUT) # set BCM7 (pin 26) as an output (LED)

try:
print ("Press CTRL+C to exit")
while True:
GPIo_Output(PA8, 1) # set port/pin value to 1/HIGH/True
sleep(5)
GPIo_Output(PA8, 0) # set port/pin value to 0/LOW/False
sleep(5)

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



File "blink_led.py", line 9, in <module>
GPIO.setup(PA8, GPIO.OUT) # set BCM7 (pin 26) as an output (LED)
NameError: name 'PA8' is not defined
 
Их 3 штуки и они разные тут теперь вопрос какой стоит
 
http://psenyukov.ru/работа-с-gpio-разъемами-в-orange-pi/
 
http://psenyukov.ru/работа-с-gpio-разъемами-в-orange-pi/


А какой тут вариант нужно выбрать?

root@Repka-Pi:~/gpio-test/wiringOP# ./build
All available boards:
0. orangepir1
1. orangepizero
2. orangepizero-lts
3. orangepipc
4. orangepipch5
5. orangepipcplus
6. orangepiplus2e
7. orangepione
8. orangepioneh5
9. orangepilite
10. orangepiplus
11. orangepizeroplus2h3
12. orangepizeroplus
13. orangepipc2
14. orangepiprime
15. orangepizeroplus2h5
16. orangepiwin
17. orangepiwinplus
18. orangepi3
19. orangepi3-lts
20. orangepilite2
21. orangepioneplus
22. orangepi4
23. orangepi4-lts
24. orangepirk3399
25. orangepi800
26. orangepizero2
27. orangepizero2-lts
28. orangepizero2-b
29. orangepizero3
30. orangepir1plus-lts
31. orangepir1plus