Différences entre versions de « Mydin-async-or-not »

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche
Ligne 20 : Ligne 20 :
 
== Creating myDin ==
 
== Creating myDin ==
  
 +
=== Step 1: identification ===
 
To properly instantiate the DIN controller, you must identifies:
 
To properly instantiate the DIN controller, you must identifies:
 
# controller board
 
# controller board
Ligne 41 : Ligne 42 :
  
 
The information can be retrieved from the [[Mydin-modules-and-classes|Modules and classes]] reference grid
 
The information can be retrieved from the [[Mydin-modules-and-classes|Modules and classes]] reference grid
 +
 +
=== Step 2: create instances ===
 +
 +
<syntaxhighlight lang="python">
 +
x
 +
</syntaxhighlight>
  
  
 
{{MyDin-TRAILER}}
 
{{MyDin-TRAILER}}

Version du 21 avril 2025 à 21:58

Introduction

MyDin can be programmed:

  1. with standard Python code (classes, functions, types, etc)... name it "the procedural way".
  2. 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

Step 1: identification

To properly instantiate the DIN controller, you must identifies:

  1. controller board
  2. 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

  1. Pico based controller (3 modules DIN)
  2. two relay board (3 modules DIN)

MyDin-3modules.jpg

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

The information can be retrieved from the Modules and classes reference grid

Step 2: create instances

x


Modèle:MyDin-TRAILER