PWM
R2026bGenerate pulse width modulated signal on analog output pin of Arduino SAMD21 core
Since R2023b
Libraries:
Simulink Support Package for Arduino Hardware /
Advanced /
SAMD
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® SAMD 21 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 MKR 1000
Arduino MKR ZERO
Arduino MKR Wi-Fi® 1010
Arduino Nano 33 IoT
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.
"arduinosamdlib/PWM"
Example: add_block("arduinosamdlib/PWM","myModel/myBlock",MakeNameUnique="on")
Version History
Introduced in R2023b