keepblue / pxt-iot-environment-kit

MakeCode package for the ElecFreaks IoT Environment Kit for micro:bit (beta)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Environment_IoT package

Environment_IoT package is developed under the cooperation of ELECFREAKS, CLASSROOM and TINKERCADEMY.

Environment IoT Kit can detect all kinds of environment data like temperature, humidity,wind speed, light intensity, noise, dust, PM2.5 and so on. Besides, you can upload these environment data to thingspeak IoT server through ESP8266 serial wifi module.

Before start, you have to register an account of thingspeak.

Hardware list

  1. ELECFREAKS Octopus:bit.
  2. IIC OLED display
  3. Sound Sensor
  4. Octopus Temperature And Humidity Sensor
  5. Octopus Soil Moisture Sensor
  6. Octopus Analog Photocell
  7. Dust Sensor
  8. PM2.5/PM10
  9. Win Sensor
  10. ESP8266 Serial Wifi Module

Basic usage

  1. Open Microsoft Makecode/microbit and create a new project
  2. Search and add the environment package
  3. Use the Environment_IoT drawer in the editor to drag out and arrange the blocks
  4. Click Download to move your program to the micro:bit

Example

dust sensor init

Initialize dust sensor. Set pin vLED and VO.

Environment_IoT.initdust(DigitalPin.P10, AnalogPin.P1)

read dust

get dust(μg/m³)

Environment_IoT.initdust(DigitalPin.P10, AnalogPin.P1)
basic.forever(() => {
    basic.showNumber(Environment_IoT.ReadDust())
})

read temperature

get DHT11 Temperature(℃)

basic.forever(() => {
    basic.showNumber(Environment_IoT.ReadTemperature(AnalogPin.P0))
})

read PM2.5

get pm2.5(μg/m³)

basic.forever(() => {
    basic.showNumber(Environment_IoT.ReadPM25(DigitalPin.P11))
})

read PM10

get pm10(μg/m³)

basic.forever(() => {
    basic.showNumber(Environment_IoT.ReadPM10(DigitalPin.P12))
})

read soil moisture

get soil moisture, Value Range: 0~100.

basic.forever(() => {
    basic.showNumber(Environment_IoT.ReadSoilHumidity(AnalogPin.P3))
})

read wind speed

get wind speed(m/s)

basic.forever(() => {
    basic.showNumber(Environment_IoT.ReadWindSpeed(AnalogPin.P4))
})

License

MIT

Supported targets

  • for PXT/microbit (The metadata above is needed for package search.)
environment=github:elecfreaks/pxt-environment
iot=github:elecfreaks/pxt-environment

About

MakeCode package for the ElecFreaks IoT Environment Kit for micro:bit (beta)


Languages

Language:TypeScript 98.5%Language:Makefile 1.5%