Power & Source of Big Ideas

RPi.GPIO_NP

Moderators: chensy, FATechsupport

Hello colleagues!

Help me please to solve problem with access to GPIO from Python3.

I have script gpio-test.py:

Code: Select all

import RPi.GPIO as GPIO
import time

led1 = 11
led2 = 13

GPIO.setmode(GPIO.BOARD)
GPIO.setup(led1, GPIO.OUT)
GPIO.setup(led2, GPIO.OUT)

while True:
        GPIO.output(led1, True)
        GPIO.output(led2, True)
        time.sleep(2)
        GPIO.output(led1, False)
        GPIO.output(led2, False)
        time.sleep(2)

It is a standard and simple script.
If I run this like pyton gpio-test.py everything is good. LED's blink every two seconds.
But if I run this like python3 gpio-test.py LED's not blink :-( and I have not any error. So as I right understand the RPi.GPIO is not work under Python3. How I can silve it?
BOARD="NanoPi-NEO-Plus2"
BOARD_NAME="NanoPi-NEO-Plus2"

For python3

Code: Select all

git clone https://github.com/Tungsteno74/NPi.GPIO

...

Code: Select all

python3 setup.py install

...

i

Code: Select all

mport NPi.GPIO as GPIO
PIN_NUM = 7
GPIO.setmode(GPIO.BOARD)
GPIO.setup(PIN_NUM,GPIO.OUT)
GPIO.output(PIN_NUM,True)
sleep(1)
GPIO.output(PIN_NUM,False)
sleep(1)


worked.

Who is online

In total there are 5 users online :: 0 registered, 0 hidden and 5 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 5 guests