Ligne 254 : |
Ligne 254 : |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |
− | This section is immediately followed by the various CONSTANT declaration. | + | This section is immediately followed by the various CONSTANT used in the script. |
| | | |
| <syntaxhighlight lang="python"> | | <syntaxhighlight lang="python"> |
Ligne 286 : |
Ligne 286 : |
| bmp = BME280( i2c=i2c, address=BMP280_I2CADDR ) | | bmp = BME280( i2c=i2c, address=BMP280_I2CADDR ) |
| </syntaxhighlight> | | </syntaxhighlight> |
| + | |
| + | At the end of initialization section, we do creates the instances for the analog reading (the TMP36, named {{fname|adc}}) and LED controling (named {{fname|led}}). |
| + | |
| + | <syntaxhighlight lang="python"> |
| + | # TMP36 analog pin |
| + | adc = ADC(Pin(26)) |
| + | # Onboard LED |
| + | led = Pin(25, Pin.OUT) |
| + | </syntaxhighlight> |
| + | |
| + | Just before the main loop, the script print the essential data. |
| + | |
| + | <syntaxhighlight lang="python"> |
| + | # Main Loop |
| + | print( 'Frequency :', rfm.frequency_mhz ) |
| + | print( 'encryption :', rfm.encryption_key ) |
| + | print( 'NODE_ID :', NODE_ID ) |
| + | print( 'BASESTATION_ID:', BASESTATION_ID ) |
| + | print( '***HEADER***' ) |
| + | print( ":iteration_count,time_sec,pressure_hpa,tmp36_temp,bmp280_temp;" ) |
| + | print( '***DATA***' ) |
| + | </syntaxhighlight> |
| + | |
| + | The main loop is composed of an infinite {{fname|while}} loop. |
| | | |
| == Fault tolerant design == | | == Fault tolerant design == |