The MakeCode extension for the HTS221 temperature and humidity sensor allows you to use the HTS221 in a graphical way. The extension is ported from the MicroPython driver , retaining the oneshot mode and power switch functions, and simplifying them for easier use.
How to use
- Connect the sensor's I2C to the micro:bit
- Open MakeCode
- Select Extensions in the menu, then enter the following extension URL in the address bar.
- After searching, click HTS221
- Add the HTS221 block to the program and start programming.
Extension URL : https://github.com/makecode-extensions/HTS221
Demo program : https://makecode.microbit.org/_R4T8LUdoa5ea
basic.forever(function () {
serial.writeValue("T", HTS221.temperature(HTS221.HTS221_T_UNIT.C))
serial.writeValue("H", HTS221.humidity())
led.toggle(0, 0)
basic.pause(1000)
})
This content is originally created by dcexpert , a user of EEWORLD forum. If you want to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source