This tutorial explains how Pulse-Width Modulation is used with Raspberry Pi and gpiozero to regulate brightness of LEDs.
0:00 Intro
0:38 gpiozero PWMLED Class
0:59 PWMLED pulse() method
2:00 PWMLED value Property
2:45 Powers or 2 Formula Explained
4:05 Powers or 2 Formula in Python (10 Brightness Steps)
5:30 Powers or 2 Formula (50 Brightness Steps)
6:12 Logarithmic Formula Explained
6:46 Logarithmic Formula in Python (10 Brightness Steps)
8:02 Logarithmic Formula (50 Brightness Steps)
8:42 Logarithmic Formula as a Function
9:04 Using Logarithmic Formula with PWMLED value (100 Brightness Steps)
9:52 Lookup Table Approach
11:25 Using Lookup Tables in Loops
Complete code: https://github.com/mheidenreich/PWMLEDs/
(Note: code posted may contain small updates and/or bug fixes not shown in the video)
Disclaimer:
"Raspberry Pi" and the distinct logo are a trademark of the Raspberry Pi Foundation.
Music: Flames by Dan Henig, YouTube Music Library