PWM
R2026bGenerate pulse width modulated signal on analog output pin of Arduino AVR core
Since R2024a
Libraries:
Simulink Support Package for Arduino Hardware /
Advanced /
AVR
Description
Add-On Required: This feature requires the Simulink Support Package for Arduino Hardware add-on.
Use the PWM block to generate square pulses of varying duty cycle on the Arduino® AVR hardware pin.
Note
The PWM block supports C/C++ code generation. This feature allows you to generate C and C++ code using Embedded Coder®.
Supported Arduino Boards
Arduino Uno
Arduino Mega 2560
Arduino Mega ADK
Arduino Leonardo
Arduino Micro
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.
"arduinoavrlib/PWM"
Example: add_block("arduinoavrlib/PWM","myModel/myBlock",MakeNameUnique="on")
Version History
Introduced in R2024a