Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New to Python USING PWM
#1
Hello All,

I have wracked my brain and the web attempting to solve this pwm problem. I am new to Python. I am trying to just run a PWM pin using:

my beaglebone black (Rev. C) which has Debian GNU/Linux 8.4 Jessie pre-installed on it. I just purchased it very recently.

The beagle board also has Python 2.7.9 installed on it. I am attempting to follow along with this very nice online tutorial by TopTechBoy on youtube (https://www.youtube.com/watch?v=vAR8v96J3FQ). This video was done in 2015 so I think perhaps a lot may have changed in the world of python and beaglebones to the point where if you run code on current boards, it wont work. All lessons up too now have worked. Unfortunately, when I run his code:

import Adafruit_BBIO.PWM as PWM
myPWM="P8_13"
PWM.start(myPWM, 0, 1000)
for I in range(0,5):
DC=int(raw_input("What Duty Cycle Would You Like"))
PWM.set_duty_cycle(myPWM, DC)
PWM.stop(myPWM)
PWM.cleanup()


on my board (using VNC Viewer or Putty) it craps out with a runtime error:
Traceback (most recent call last):
File "PWM.py" line 7, in <module>
PWM.set_duty_cycle(myPWM, DC)
RuntimeError: You must start() the PWM channel first

I have started my PWM. Also, I feel it also has something to do with the fact that the original input() function call I was also not able to use. I have to use raw_input() and then typecast the returned information. Can someone assist me with this confusion?

Many thanks in advance to solve this thank you!
Reply


Messages In This Thread
New to Python USING PWM - by iawia - Jul-27-2018, 07:18 PM
RE: New to Python USING PWM - by Vysero - Jul-27-2018, 07:59 PM
RE: New to Python USING PWM - by iawia - Jul-27-2018, 09:40 PM
RE: New to Python USING PWM - by woooee - Jul-27-2018, 10:06 PM
RE: New to Python USING PWM - by iawia - Jul-28-2018, 03:18 PM
RE: New to Python USING PWM - by iawia - Jul-30-2018, 05:09 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020