pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

NCIR2 Unit

Example

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

setScreenColor(0x222222)
ncir2_0 = unit.get(unit.NCIR2, unit.PORTA)

ncir2_0.init_i2c_address(0x5A)
while True:
  print((str('temperature:') + str((ncir2_0.temperature_measure()))))
  print((str('emissivity:') + str((ncir2_0.emissivity_measure()))))
  print((str('threshold value:') + str((ncir2_0.temperature_threshold(0x20)))))
  print((str('buzzer frequency:') + str((ncir2_0.temp_buzzer_freq(0x40)))))
  wait(1)
  wait_ms(2)

API

ncir2_0.init_i2c_address(0x5A)
  • Initialize I2C communication address
print(ncir2_0.button_status())
  • Retrieve button state (pressed or released)
print(ncir2_0.buzzer_control())
  • Retrieve buzzer enable status (on or off)
print(ncir2_0.buzzer_duty())
  • Retrieve buzzer duty cycle (duty cycle value 0-255, higher value indicates louder sound)
print(ncir2_0.buzzer_freq())
  • Retrieve buzzer frequency value (default 4000 Hz)
print(ncir2_0.read_device_status(0xFE))
  • Retrieve device firmware version or I2C address (default I2C address is 0x5A)
print(ncir2_0.chip_temperature_measure())
  • Retrieve device temperature value (in ℃)
print(ncir2_0.emissivity_measure())
  • Retrieve reflectance of an object's surface
print(ncir2_0.rgb_led())
  • Retrieve RGB LED color (RGB values range from 0-255)
print(ncir2_0.temperature_measure())
  • Retrieve temperature value (redundant, but assuming it's for clarity)
print(ncir2_0.temp_buzzer_duty(0x44))
  • Set buzzer duty cycle at maximum and minimum temperature thresholds (duty cycle value 0-255, higher value indicates louder sound)
print(ncir2_0.temp_buzzer_freq(0x40))
  • Retrieve buzzer frequency at maximum or minimum temperature thresholds (default 4000 Hz, higher value indicates sharper sound)
print(ncir2_0.temp_alarm_interval(0x42))
  • Retrieve buzzer high-low level intervals at maximum or minimum temperature thresholds (default low: 100, high: 204)
print(ncir2_0.temp_alarm_led(0x30))
  • Retrieve LED color at maximum or minimum temperature thresholds (RGB values range from 0-255)
print(ncir2_0.temperature_threshold(0x20))
  • Retrieve maximum and minimum temperature thresholds (default set to minimum 10°C, maximum 37°C)
ncir2_0.save_config_setting()
  • Save current configuration settings
ncir2_0.buzzer_duty(80)
  • Retrieve buzzer duty cycle (duty cycle value 0-255, higher value indicates louder sound) (redundant, but for completeness)
ncir2_0.buzzer_freq(4000)
  • Set buzzer frequency (default 4000 Hz, higher value indicates louder sound, but note: frequency does not directly correlate to loudness, it affects pitch)
ncir2_0.buzzer_control(0x01)
  • Set buzzer enable status (on or off)
ncir2_0.emissivity_measure(0.95)
  • Set reflectance (skin reflectance is 0.95)
ncir2_0.write_i2c_address(0x5A)
  • Set device's I2C address (default 0x5A)
ncir2_0.rgb_led(50, 50, 50)
  • Set RGB LED color values (RGB values range from 0-255)
ncir2_0.temp_buzzer_duty(0x44, 80)
  • Set buzzer duty cycle at maximum and minimum temperature thresholds (duty cycle value 0-255, higher value indicates louder sound) (redundant, but for consistency)
ncir2_0.temp_buzzer_freq(0x40, 4000)
  • Set buzzer intervals at maximum or minimum temperature thresholds (higher value indicates faster response)
ncir2_0.temp_alarm_interval(0x42, 100)
  • (Duplicate entry) Set buzzer intervals at maximum or minimum temperature thresholds (higher value indicates faster response)
ncir2_0.temp_alarm_led(0x30, 50, 50, 50)
  • Set buzzer frequency at maximum or minimum temperature thresholds (default 4000 Hz, higher value indicates sharper sound)
ncir2_0.temperature_threshold(0x20, 25)
  • Set LED RGB color values at maximum or minimum temperature thresholds (RGB values range from 0-255)
On This Page