XinaBox SW01 MakeCode extension
This library provides functions to access environmental data from the XinaBox SW01.
The SW01 uses a Bosch BME280 to report:
- atmospheric pressure.
This library provides functions that give you access to these variables, as well some measures that can be derived from them:
- pressure altitude
- density altitude
- cloud base
There are 3 other functions:
- power on/off
- set address
By default the SW01 power is On, and the address is set correctly (to Off). You do NOT need to power on the SW01 or set the address to use it
A comprehensive set of How-to guides that show you how to use the blocks is available online: XinaBox How-to guides for the SW01 on BBC micro:bit using MakeCode
Core functions: Temperature:
// Show the temperature in Celcius on the micro:bit 5x5 LED matrix: basic.showNumber(SW01.temperature(Temperature.Celcius)) // Show the temperature in Celcius on the micro:bit 5x5 LED matrix: basic.showNumber(SW01.temperature(Temeperature.Celcius))
Core functions: Humidity:
// Show the relative humidity (as a percentage) on the micro:bit 5x5 LED matrix: basic.showNumber(SW01.humidity())
Core functions: Atmospheric pressure:
// Show the atmospheric pressure in HectoPascals (Pascals / 100) on the micro:bit 5x5 LED matrix: basic.showNumber(SW01.pressure(Pressure.HectoPascal)) // Show the atmospheric pressure in MilliBar (same as HectoPascal) on the micro:bit 5x5 LED matrix: basic.showNumber(SW01.pressure(Pressure.MilliBar))
The library is based on BME280 Package from microbit/micropython Chinese community.
Thanks also to Shaoziyang for all the heavy lifting :)
Copyright (c) 2019, XinaBox Limited