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
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, ...