modelScenario
Scenario driven by time tables: button presses, accelerometer shake, temperature and light ramps - no external wiring needed
Extends from Modelica.Icons.Example (Icon for runnable examples).
Information
Expected result: the script starts by showing a heart, then reacts to the time-table-driven events:
- t=1 s : accelerometer shake (accelX table peaks at 5 m/s^2) - the display shows a surprised face briefly.
- t=2 s : button A pressed (table) - the counter increments, the display shows the count.
- t=3 s : button B pressed (table) - the counter resets, the display shows a sad face.
- t=5 s : button A pressed again - the counter shows 1.
- t=0..5 s : light ramps from 200 to 50 (table) - the script scrolls the light level when it changes by 30+.
- t=0..10 s : temperature ramps from 27 to 35 degC (table) - the script scrolls the temperature when it changes by 2+ degC.
No external wiring is needed: each button and sensor source is set to Table (dropdowns of the Buttons and Sensors tabs), with the default time tables of the board. The same program runs unchanged on a physical micro:bit (wired to real buttons and sensors).
Components
| Type | Name | Default | Description |
|---|---|---|---|
| MicroPythonMCU.MicroBit_v2 | mb | Program: Resources/Scripts/MCU/microbit_scenario.py; boutons et capteurs pilotes par les tables horaires internes (onglets Buttons et Sensors) | |
| Modelica.Electrical.Analog.Basic.Ground | ground |