-
Notifications
You must be signed in to change notification settings - Fork 219
Closed
Description
I wrote a code which needs 50Hz PWM. The code is given below. PWM P9_14 ,P9_42 and P8_13 works fine at 50 Hz but P8_19 (also P9_16) doesnt start any dedicated Hz PWM it only works with default. I couldnt find solution. Please help me to find what is the problem?
Pot driven PWM outputs code in Python.
import Adafruit_BBIO.ADC as ADC
import Adafruit_BBIO.PWM as PWM
# analog input setup
ADC.setup()
analogPin="P9_33"
# pwm start with default which works fine
""" passive
PWM.start("P9_14", 10.0)
PWM.start("P9_42", 10.0)
PWM.start("P8_13", 10.0,)
PWM.start("P8_19", 10.0)
"""
# dedicated frequency for PWM. It doesnt start (Also 490Hz not working)
PWM.start("P9_14", 10.0,50)
PWM.start("P9_42", 10.0,50)
PWM.start("P8_13", 10.0,50)
PWM.start("P8_19", 10.0,50)
gir=raw_input("begin")
while (1):
#read pot and write to pwm port
potVal=ADC.read(analogPin)*100
print potVal
PWM.set_duty_cycle("P9_14",potVal)
PWM.set_duty_cycle("P9_42",potVal)
PWM.set_duty_cycle("P8_13",potVal)
PWM.set_duty_cycle("P8_19",potVal)
if potVal==0:
break
PWM.stop("P9_14")
PWM.stop("P9_21")
PWM.stop("P8_13")
PWM.stop("P8_19")
PWM.cleanup()
Error respond with dedicated frequency like below but it start:
PWM.set_duty_cycle("P8_19",potVal)
RuntimeError: You must start() the PWM channel first
Configuration: Beaglebone Black RevC, Debian Wheezy
acseckin and roytu
Metadata
Metadata
Assignees
Labels
No labels