Skip to content

BeagleBone Blue PWM #313

Open
Open
@ansarid

Description

@ansarid
  • Platform/operating system: BeagleBone Blue, bone-debian-9.5-iot-armhf-2018-10-07

  • Python version: Python 3.5.3 and Python 2.7.13

  • Error message you are receiving, including any Python exception traces:

debian@beaglebone:~$ sudo python3 fade.py
Traceback (most recent call last):
  File "fade.py", line 6, in <module>
    PWM.start(pwm, 0)
ValueError: Invalid PWM key or name.
  • List the steps to reproduce the problem below:

Code:fade.py

import Adafruit_BBIO.PWM as PWM

pwm = "P9_23"

#PWM.start(channel, duty, freq=2000, polarity=0)
PWM.start(pwm, 0)

#optionally, you can set the frequency as well as the polarity from their defaults:
#PWM.start(pwm, 50, 1000, 1)

PWM.set_frequency(pwm, 10)

PWM.set_duty_cycle(pwm, 0)

for x in range(10000):

    for duty in range(0,100,1):

        PWM.set_duty_cycle(pwm, duty)
        time.sleep(0.05)

    for duty in range(0,100,-1):

        PWM.set_duty_cycle(pwm, duty)
        time.sleep(0.05)

Run:

sudo python3 fade.py

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions