Skip to content

xinabox/pxt-SW01

Repository files navigation

GitHub Issues GitHub Commit Maintained Build status badge Build status badge Developer

XinaBox SW01 MakeCode extension

This library provides functions to access environmental data from the XinaBox SW01.

Read more about it or purchase one here

The SW01 uses a Bosch BME280 to report:

  • temperature
  • humidity
  • atmospheric pressure.

This library provides functions that give you access to these variables, as well some measures that can be derived from them:

  • dewpoint
  • pressure altitude
  • density altitude
  • cloud base

There are 3 other functions:

  • power on/off
  • set address

~ hint

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

~

How-to guides:

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(SW01.Temperature.Celcius))

// Show the temperature in Celcius on the micro:bit 5x5 LED matrix:
basic.showNumber(SW01.temperature(SW01.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(SW01.Pressure.HectoPascal))

// Show the atmospheric pressure in MilliBar (same as HectoPascal) on the micro:bit 5x5 LED matrix:
basic.showNumber(SW01.pressure(SW01.Pressure.MilliBar))

Attribution:

The library is based on BME280 Package from microbit/micropython Chinese community.

Thanks also to Shaoziyang for all the heavy lifting :)

License:

MIT

Copyright (c) 2019, XinaBox Limited

Supported targets:

  • PXT/microbit
  • PXT/CC03
  • PXT/CS11
  • PXT/CW03