Memorial day is 05/25/2015 – Orders will ship out on May 26th. There will not be any deliveries or shipping on Monday. Any order placed after 11am ET on Friday May 22nd will not start to ship out until Tuesday May 26th.
Below are a few examples of using the Adafruit_BBIO.PWM module. It's fairly simple to use as well!

Setup

To setup a pin to use PWM:
Copy Code
import Adafruit_BBIO.PWM as PWM
#PWM.start(channel, duty, freq=2000, polarity=0)
PWM.start("P9_14", 50)

#optionally, you can set the frequency as well as the polarity from their defaults:
PWM.start("P9_14", 50, 1000, 1)
The valid values for duty are 0.0 to 100.0. The start method activate pwm on that channel. There is no need to setup the channels with Adafruit_BBIO.PWM.

Once you've started, you can then set the duty cycle, or the frequency:
Copy Code
PWM.set_duty_cycle("P9_14", 25.5)
PWM.set_frequency("P9_14", 10)
You'll also want to either disable that specific channel, or cleanup all of them when you're done:
Copy Code
PWM.stop("P9_14")
PWM.cleanup()
Last updated on 2015-05-04 at 04.27.11 PM Published on 2013-06-13 at 05.16.24 PM