-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"This channel is already in use" error #1
Comments
Hi!
This was a school project I worked on last semester, I haven't really
maintained the code after the project elapsed.
If you can send me the exact error you get I can dig around in the code to
see what went wrong.
Best regards,
Eutim Putnoki
|
Once manual initialization in shell as output1.mp4 |
Thank you very much! |
eutim
changed the title
When I tried to use the pins, error message came out as "Pin# is reserved".
"This channel is already in use" error
Jun 22, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have tried to use soft PWM for control of dual motor controller for speed changes.
Following code is almost identical to the one that I have used for Orange Pi Zero with no problem.
It is differ only the pin numbers to match with Orange Pi Zero 2.
When I tried to use the pins, error message came out as "Pin# is reserved".
However, if I manually set the pin as output once using "gpio mode wPI# out" for 4 pints, then this code runs without an error.
I guess, it is missing initialization step somewhere.
#!/usr/bin/env python
-- coding: utf-8 --
Original Base Demo File : pwm_dutycycle.py
import OPi.GPIO as GPIO
from time import sleep
GPIO.setboard(GPIO.H616) # It is for Orange Pi Zero 2 board
GPIO.setmode(GPIO.BOARD) # set up BOARD BCM numbering
GPIO.setup(7, GPIO.OUT) # set Motor A : right wheel forward
GPIO.setup(19, GPIO.OUT) # set Motor A : right wheel backward
GPIO.setup(15, GPIO.OUT) # set Motor B : left wheel forward
GPIO.setup(21, GPIO.OUT) # set Motor B : left wheel backward
rwf = GPIO.PWM(7, 10) # new PWM on 7 freq.=30Hz
rwb = GPIO.PWM(19, 10) # new PWM on 19 freq.=30Hz
lwf = GPIO.PWM(15, 10) # new PWM on 15 freq.=30Hz
lwb = GPIO.PWM(21, 10) # new PWM on 21 freq.=30Hz
def stop_motors() :
rwf.start(0)
rwb.start(0)
lwf.start(0)
lwb.start(0)
try:
stop_motors()
while 1:
for dc in range(0, 101, 5):
rwf.ChangeDutyCycle(dc)
lwf.ChangeDutyCycle(dc)
sleep(0.1)
stop_motors()
sleep(1)
for dc in range(0, 101, 5):
rwb.ChangeDutyCycle(dc)
lwb.ChangeDutyCycle(dc)
sleep(0.1)
stop_motors()
sleep(1)
except KeyboardInterrupt:
pass
rwf.stop()
rwb.stop()
lwf.stop()
lwb.stop()
GPIO.cleanup()
The text was updated successfully, but these errors were encountered: