Let's do an exercise and see the PWM waveform in a logic analyzer, which is a piece of equipment used to visualize electronic signals. While the general principles behind PWM are technically simple, to aid learning when starting out, it can be helpful to visualize what a PWM signal looks like and observe how it changes visually as its duty cycle and frequency change.
PiGPIO contains a software logic analyzer we can use for this purpose. Now, I need to point out that it's a basic software logic analyzer and in no way compares to professional-grade equipment, however, for our example and education, it will work a treat and cost us nothing.
Let's download, install, and run PiScope. Here are the steps to follow:
- First, we must install PiScope. Run the following commands to download, compile, and install PiScope:
# Download and install piscope
$ cd ~
$ wget abyz.me.uk/rpi/pigpio/piscope.tar
$ tar xvf piscope.tar
$ cd PISCOPE
$ make...