Différences entre versions de « Mydin-async-or-not »
Ligne 26 : | Ligne 26 : | ||
These information will determine the Python modules to load and the classes names to be used. | These information will determine the Python modules to load and the classes names to be used. | ||
− | The | + | The picture shown below combines a "Pico based controller (3 modules DIN)" and a "two relay board (3 modules DIN)". |
[[Fichier:MyDin-3modules.jpg|480px]] | [[Fichier:MyDin-3modules.jpg|480px]] |
Version du 21 avril 2025 à 21:41
Introduction
MyDin can be programmed:
- with standard Python code (classes, functions, types, etc)... name it "the procedural way".
- with asynchronous code (known as AsyncIO)... a kind of multitasking!
The libraries provided with myDin support the both approaches for programming myDin.
In any cases, the myDin library will simplifies the access to the underlaying hardware.
For sure, experimented MicroPython user can also use the schematics and creates their own software stack from the top to the bottom.
By creating and configuring the myDin classes (see later), your code already get a direct access to all the features in the procedural way.
When calling the additional setup() and run() methods the myDin will starts asynchronous processing.
We strongly encourage to use the asynchronous approach for your projects.
Creating myDin
To properly instantiate the DIN controller, you must identifies:
- controller board
- back-plane board
These information will determine the Python modules to load and the classes names to be used.
The picture shown below combines a "Pico based controller (3 modules DIN)" and a "two relay board (3 modules DIN)".
The "Pico based controller (3 modules DIN)" is known under the product code DINCASE-MB3PICO (Middle Board 3 modules with Pico).
- The module to load is mydin.pico
- The class to instantiate is Pico3Mod
The "two relay board (3 modules DIN)" is known under the product code DINCASE-2R-BP3MOD (2 Relays BackPlane 3 Modules).
- The module to load is mydin.backplane.relays
- The class to instantiate is TwoRelay3Mod