Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Beaglebone Python Programming

You're reading from   Learning Beaglebone Python Programming Unleash the potential of BeagleBone using Python

Arrow left icon
Product type Paperback
Published in Jul 2015
Publisher
ISBN-13 9781784399702
Length 196 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Alexander C Hiam Alexander C Hiam
Author Profile Icon Alexander C Hiam
Alexander C Hiam
Arrow right icon
View More author details
Toc

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 $19.99/month. Cancel anytime
Banner background image