O'Reilly logo

Programming the BeagleBone by Yogesh Chavan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Program to fade in and fade out LED

In Chapter 6, PWM – Writing Analog Information we saw that to control analog devices, BeagleBone uses a PWM subsystem. It generates analog values on some specific pins turning that pin HIGH and LOW very fast in patterns. Learning PWM involved learning about frequency, period, duty cycle and average voltage in Chapter 6. The resultant voltage is proportional to the duty cycle. If the duty cycle is increased, the resultant voltage will increase. We generated a range of resultant analog voltage on pin by changing the duty cycle. We did a LED fade in and fade out exercise using PWM. Let's do that program again in Python.

Connect an LED to P9_21 as shown in the diagram in Chapter 6. Type the following program in Cloud9, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required