Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning Beaglebone Python Programming

You're reading from  Learning Beaglebone Python Programming

Product type Book
Published in Jul 2015
Publisher
ISBN-13 9781784399702
Pages 196 pages
Edition 1st Edition
Languages

PWM


The BeagleBone's PWM subsystem contains three enhanced PWM (ePWM) modules and one enhanced capture (eCAP) module, all of which have their own two outputs, for a total of up to eight PWM outputs (refer to Appendix A, The BeagleBone Black Pinout to see which pins support PWM). We briefly covered what PWM is in Chapter 1, Before We Begin, but let's look at it in a bit more detail before we start using it.

For this, you will need:

  • Breadboard

  • 1x 5 mm LED

  • 1x 4.7 kΩ resistor

  • 1x 68 Ω resistor

  • 1x 2N3904 NPN transistor

  • Jumper wires

Let's start by wiring up an LED with an NPN transistor as we did in Chapter 3, Digital Outputs; only this time, we will drive it with the ePWM1 module's 'A' output on P9.14:

Now let's fire up the Python interactive interpreter and configure the PWM output at 50 percent duty cycle:

>>> from bbio import *
>>> analogWrite(PWM1A, 50, 100)

You should see the LED turn on, but dimmer than if you had driven it with a GPIO pin. So what's going on here? The analogWrite...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}