Modifications

Sauter à la navigation Sauter à la recherche
277 octets ajoutés ,  29 avril 2025 à 17:13
Ligne 90 : Ligne 90 :     
def setup( din ):
 
def setup( din ):
−
   # Add a new attribute to "din" instance
+
   # Add a new attribute "sensor" to "din" instance
 
   din.sensor = BME280( i2c=din.i2c, address=BMP280_I2CADDR )
 
   din.sensor = BME280( i2c=din.i2c, address=BMP280_I2CADDR )
   Ligne 102 : Ligne 102 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
Notice the definition of the {{fname|def setup():}} function and its referencing in {{fname|din.setup( setup='''setup''', loop=loop )}} call.
+
Remarks:
 +
* Notice the {{fname|def setup():}} function definition and its reference in {{fname|1=din.setup( setup='''setup''', loop=loop )}} call.
 +
* The instance of BME280 is stored under the '''din.sensor''' attribute.
 +
* The {{fname|def setup():}} function '''IS NOT AN ASYNC''' function.
 +
* The {{fname|async def loop( din )}} ''userloop'' can retreive the BME280 instance from the '''din.sensor''' attribute.
    
== Activating watchdog ==
 
== Activating watchdog ==
    
== Add Scheduler Task ==
 
== Add Scheduler Task ==
32 908

modifications

Menu de navigation