pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Unit CO2l

Example

Obtain atmospheric CO2L concentration, temperature, humidity and atmospheric pressure data collected by Unit CO2L

from m5stack import *
from m5ui import *
from uiflow import *
import unit

setScreenColor(0x222222)
co2l_0 = unit.get(unit.CO2_SCD41, unit.PORTA)

co2l_0.start_periodic_measurement()
while True:
  print(co2l_0.co2)
  print(co2l_0.data_isready())
  print(co2l_0.get_temperature_offset())
  print(co2l_0.get_sensor_altitude())
  print(co2l_0.serial_number())
  wait_ms(2)

API

co2l_0.stop_periodic_measurement()
  • Stop Periodic Measurements

co2l_0.factory_reset()
  • Perform Factory Reset
co2l_0.force_calibration(400)
  • Force Recalibration of CO2
print(co2l_0.get_calibration_enabled())
  • Get Auto-Calibration Enabled Status
print(co2l_0.data_isready())
  • Get Data Ready Status
print(co2l_0.get_sensor_altitude())
  • Get Sensor Height
co2l_0.read_sensor_measurement()
  • Wait for Sensor Measurement Update
print(co2l_0.serial_number())
  • Get Sensor Serial Number
print(co2l_0.get_temperature_offset())
  • Get Temperature Offset
co2l_0.persist_settings()
  • Save All Settings to EEPROM
co2l_0.sleep_mode()
  • Set Sensor to Sleep Mode
print(co2l_0.co2)
  • Get CO2/Humidity/Temperature Values
co2l_0.reinit()
  • Reinitialize Sensor
co2l_0.self_test()
  • Perform Self-Test
co2l_0.set_ambient_pressure(0)
  • Set Ambient Air Pressure
co2l_0.set_calibration_enabled(1)
  • Set Auto-Calibration Enabled
co2l_0.set_sensor_altitude(0)
  • Set Sensor Height from Ground (Mark)
co2l_0.set_temperature_offset(4)
  • Set Temperature Offset

co2l_0.single_shot_measurement_all()
  • All single measurements (low power mode) (5s to obtain a value)
co2l_0.single_shot_measurement_ht()
  • Single measurement of humidity and temperature
co2l_0.start_low_periodic_measurement()
  • Set Temperature Offset
co2l_0.start_periodic_measurement()
  • Start Device Measurements
co2l_0.wake_up()
  • Wake Up Sensor
On This Page