Our code examples from the previous sections, Using PWM to control an LED, and Visually exploring PWM with PiScope, both created a PWM signal using your Raspberry Pi's PWM hardware. Accompanying the code for this chapter and listed in the following table are alternative implementations that demonstrate the use of hardware-timed and software-generated PWM signals. You may recall that we discussed these alternatives back in the section entitled Creating PWM signals:
File |
Details |
---|---|
pwm_hardware.py |
This is hardware PWM using PiGPIO (this is the code we've seen in this chapter). You must use a PWM hardware GPIO pin 12, 13, 18, or 19. |
pwm_hardware_timed.py |
This is a hardware-timed PWM using PiGPIO. This will work with any GPIO pin. |
pwm_software.py |
This is software PWM using RPi.GPIO (PiGPIO does not provide software PWM). This will work with any GPIO pin. |
Â
Functionally...