modelTimer

GP0 drives an LED toggled by a periodic machine.Timer (500 ms) while the main script sleeps once, for a long time - proves that the Timer keeps firing without making this sleep() return early

Extends from Modelica.Icons.Example (Icon for runnable examples).

Information

Verification scenario 12 (see requirements.md): the script timer_toggle.py arms a Timer(period=500, mode=Timer.PERIODIC) that toggles led0 (GP0) every 500 ms, then does a single time.sleep(3600) — without ever reading/writing a pin itself outside the Timer callback. Expected result: GP0 toggles at each 500 ms deadline (t≈0.5/1.0/1.5/2.0 s) although nothing changes on any input of the model, proof that the Timer "pitstop" mechanism fires independently of the current sleep(), without making it return early (unlike a real input transition, see Examples.Gpio.InputReactivity). Pins GP1-GP7, unused by this scenario, are left unconnected.

Components

TypeNameDefaultDescription
MCUmcuscriptPath = Verification/timer_toggle.py
Modelica.Electrical.Analog.Basic.Groundground
Modelica.Electrical.Analog.Basic.Resistorr0limits the current of led0 (GP0)
MicroPythonMCU.Peripherals.LEDled0GP0: toggles every 500 ms, driven by machine.Timer