modelLedFade
Extends from Modelica.Icons.Example (Icon for runnable examples).
Information
Demonstrator (outside the verification scenarios): the script pwm_led_fade.py sets GP0 as a 1 kHz PWM output, waits 0.5 s, raises the duty cycle from 0 to 100 % in 1000 steps of 1 ms (duty_u16() called at each step), waits 0.5 s, lowers it back to 0 the same way, then releases the pin (deinit()). Unlike Examples.Pwm.Led, where the duty cycle is set once, it changes here while running: each call to duty_u16() is taken into account at the next sync point, and the square wave is still generated on the Modelica side between two calls. led0 lights up then dims gradually when the result is replayed with animation in OMEdit. Pins GP1-GP7, unused by this scenario, are left unconnected.
Components
| Type | Name | Default | Description |
|---|---|---|---|
| MCU | mcu | scriptPath = Resources/Scripts/MCU/pwm_led_fade.py | |
| Modelica.Electrical.Analog.Basic.Ground | ground | ||
| Modelica.Electrical.Analog.Basic.Resistor | r0 | limits the current of led0 (GP0) | |
| MicroPythonMCU.Peripherals.LED | led0 | GP0: PWM at 1 kHz, varying duty cycle (fade in, fade out) |