This is a micro:bit-based expansion board with the theme of environment and science. On a wide and easy-to-use PCB, it integrates many sensor modules of nature and science, including UV sensor, temperature sensor, humidity sensor, air pressure sensor, sound sensor, color sensor, light sensor, water temperature sensor, TDS water quality sensor, buzzer, OLED display, etc. This board is rich in knowledge, suitable for a wide range of applications. Extended GPIOs are set and it is designed to be compatible with DFRobot gravity series. Students can use this board to explore the secret of nature by detecting and collecting various nature data, and learn something about the environment and science.
NaturalScience.initDisplay()
basic.forever(function () {
NaturalScience.showUserText(0, "DFRobot")
NaturalScience.showUserNumber(1, 2019)
basic.pause(1000)
NaturalScience.clear()
basic.pause(1000)
})
basic.forever(function () {
serial.writeString(NaturalScience.readBME280Data(NaturalScience.BME280Data.Pressure))
serial.writeString(NaturalScience.readBME280Data(NaturalScience.BME280Data.Temperature))
serial.writeString(NaturalScience.readBME280Data(NaturalScience.BME280Data.Humidity))
})
basic.forever(function () {
serial.writeString("" + NaturalScience.TemperatureNumber())
serial.writeString("" + NaturalScience.getNoise())
serial.writeString(NaturalScience.getUV())
})
basic.forever(function () {
serial.writeString("" + NaturalScience.getRed())
serial.writeString("" + NaturalScience.getGreen())
serial.writeString("" + NaturalScience.getBlue())
serial.writeString("" + NaturalScience.getC())
})
basic.forever(function () {
NaturalScience.setLed(NaturalScience.STM32_LED_STATUS.ON)
basic.pause(1000)
NaturalScience.setLed(NaturalScience.STM32_LED_STATUS.OFF)
basic.pause(1000)
})
NaturalScience.setK(2.68)
basic.forever(function () {
serial.writeString(NaturalScience.getK())
serial.writeString("" + NaturalScience.getTDS())
})
MIT
Copyright (c) 2020, microbit/micropython Chinese community