PWM
R2026bGenerate pulse width modulated signal of digital output pin
Libraries:
Raspberry Pi Blockset /
Basic
Description
Use the PWM block to vary the power output of a digital output pin. This block enables a digital output to provide a range of different power levels, similar to that of an analog output.
During simulations without the hardware, this block does nothing. See Block Produces Zeros or Does Nothing in Simulation (Simulink).
Note
To generate C/C++ code for this block, you must have an Embedded Coder® license.
Ports
Input
Parameters
Programmatic Use: Add Block
To add the block programmatically, use the add_block function with one of these library block paths as the source.
"raspberrypiBasiclib/PWM"
Example: add_block("raspberrypiBasiclib/PWM","myModel/myBlock",MakeNameUnique="on")
Extended Capabilities
Version History
Introduced in R2016b