yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
World of Module Sensor Kit📖
1.Introduction
  • 1.1 Introduction
  • 1.2 Building block list
2.Programming preparation
  • 2.1 About BBC microbit
  • 2.2 About Microbit expansion board
  • 2.3 MakeCode Programming Guide
  • 2.4 Programming block reference manual
  • 2.5 Python Programming Guide
  • 2.6 Python API
3.Basic course(MakeCode)
RGB light module
  • 1.Introduction of module
  • 2.Light up a RGB
Button module
  • 1.Introduction of module
  • 2.Button detection
Rocker module
  • 1.Introduction of module
  • 2.Control rocker
Photosensitive module
  • 1.Introduction of module
  • 2. Read the light intensity
Infrared module
  • 1.Introduction of module
  • 2. Obstacle detection
TemperatureHumidity module
  • 1.Introduction of module
  • 2.Read temperature humidity
Ultrasonic module
  • 1.Introduction of module
  • 2. Ultrasonic ranging
Digital Tube module
  • 1.Introduction of module
  • 2. Digital tube display
Human body infrared module
  • 1.Introduction of module
  • 2.Human body detection
Color Recognition module
  • 1.Introduction of module
  • 2. Color recognition
Servo
  • 1.Introduction of servo
  • 2.Drive servo
4.Advanced course(MakeCode)
  • 4.1 Table lamp
  • 4.2 Rocker control light
  • 4.3 Emergency light
  • 4.4 Infrared warning device
  • 4.5 Hand-held rangefinder
  • 4.6 Human body warning device
  • 4.7 Color recognition
  • 4.8 Thermometer
  • 4.9 Smart wiper
  • 4.10 Rotating rangefinder
  • 4.12 Piggy bank
5.Creative cours(MakeCode)
  • 5.1 Running box
  • 5.2 Temperature-humidity measurement
  • 5.3 Lifting platform
  • 5.4 Interactive box
  • 5.5 Moving basket
  • 5.6 Automatic door
  • 5.7 Sunflower
  • 5.8 Flying penguin
  • 5.9 UFO catcher
  • 5.10 Color sorter
6.Basic course(Python)
  • 6.1 Light up a RGB
  • 6.2 Button detection
  • 6.3 Control rocker
  • 6.4 Read the light intensity
  • 6.5 Obstacle detection
  • 6.6 Read temperature humidity
  • 6.7 Ultrasonic ranging
  • 6.8 Digital tube display
  • 6.9 Human body detection
  • 6.10 Color recognition
  • 6.11 Drive servo
7.Advanced course(Python)
  • 7.1 Table lamp
  • 7.2 Rocker control light
  • 7.3 Emergency light
  • 7.4 Infrared warning device
  • 7.5 Hand-held rangefinder
  • 7.6 Human body warning device
  • 7.7 Color recognition
  • 7.8 Thermometer
  • 7.9 Smart wiper
  • 7.10 Rotating rangefinder
  • 7.11 Piggy bank
8.Creative course(Python)
  • 8.1 Running box
  • 8.2 Temperature-humidity measurement
  • 8.3 Lifting platform
  • 8.4 Interactive box
  • 8.5 Moving basket
  • 8.6 Automatic door
  • 8.7 Sunflower
  • 8.8 Flying penguin
  • 8.9 UFO catcher
  • 8.10 Color sorter
Download
  • Assembly Steps
  • Code
  • MicroPython_library
Download ZIP

Welcome to World of Module Sensor Kit repository

2.6 Python API

API functions

1. Yahboom World of Module

1.1 RGB module

WOM_Sensor_Kit.WOM_rgb(1023,1023,1023)

Parameter definition: WOM_rgb (red, green, blue) The color range is 0-1023, and the P14, P13, and P12 pins are fixed and cannot be changed.

1.2 Button module

WOM_Sensor_Kit.WOM_button(pin0)
Parameter definition: WOM_button (pin) returns 1 when pressed, otherwise returns 0

1.3 Rocker module

WOM_Sensor_Kit.WOM_rocker(pin0,pin1,WOM_Sensor_Kit.WOM_up)

WOM_Sensor_Kit.WOM_rocker(pin0,pin1,WOM_Sensor_Kit.WOM_down)

WOM_Sensor_Kit.WOM_rocker(pin0,pin1,WOM_Sensor_Kit.WOM_left)

WOM_Sensor_Kit.WOM_rocker(pin0,pin1,WOM_Sensor_Kit.WOM_right)

Parameter definition: WOM_rocker (pin X, pin Y, status), return 1 or 0, X and Y can be modified to other pins.

Note: keep the wiring consistent with define pin in code.

1.4 Photosensitive module

WOM_Sensor_Kit.WOM_light(pin0)

Parameter definition: WOM_light (pin X) returns the analog value 0-1023, the stronger the light, the smaller the value, X can be modified to other pins.

Note: keep the wiring consistent with define pin in code.

1.5 Infrared module

WOM_Sensor_Kit.WOM_ir(pin0)

Parameter definition: WOM_ir (pin X), returns 0 if there is an obstacle, returns 1 if there is no obstacle, X can be modified to other pins.

Note: keep the wiring consistent with define pin in code.

1.6 Temperature and humidity module

WOM_Sensor_Kit.WOM_dht11(pin0, WOM_Sensor_Kit.WOM_temp_C)

WOM_Sensor_Kit.WOM_dht11(pin0, WOM_Sensor_Kit.WOM_temp_F)

WOM_Sensor_Kit.WOM_dht11(pin0, WOM_Sensor_Kit.WOM_humidity)

Parameter definition: WOM_dht11 (pin, read data), X can be modified to other pins, pay attention to keep the wiring consistent with the program.

Return the corresponding read data, including WOM_temp_C, WOM_temp_F, WOM_humidity

The interval between each acquisition must be more than 1s.

1.7 Ultrasonic module

WOM_Sensor_Kit.WOM_ultrasonic(pin3,pin2)

Parameter definition: WOM_ultrasonic (pin Echo, pin Trig), returns ultrasonic data. Echo and Trig can be modified to other pins.

Note: keep the wiring consistent with define pin in code.

1.8 Digital tube module

WOM_Sensor_Kit.WOM_init_display(1)

Parameter definition: WOM_init_display (brightness level) range 0-7, where 0 is the largest, 1 is the smallest, and 1-7 is incremented

WOM_Sensor_Kit.WOM_display(100)

Parameter definition: WOM_display (digital) Display the digital range 0-9999, fixedly connect the SCL and SDA pins

1.9 Human body infrared sensor module

WOM_Sensor_Kit.WOM_pir(pin0)

Parameter definition: WOM_pir (pin X) If someone returns 1, X can be modified to other pins.

Note: keep the wiring consistent with define pin in code.

1.10 Color recognition module

WOM_Sensor_Kit.WOM_color(WOM_Sensor_Kit.WOM_red)

WOM_Sensor_Kit.WOM_color(WOM_Sensor_Kit.WOM_green)

WOM_Sensor_Kit.WOM_color(WOM_Sensor_Kit.WOM_blue)

Parameter definition: WOM_color (acquired color), returns the read color RGB value, the range of the returned value is [0, 255], fixedly connected to the SCL and SDA pins

1.11 Servo

WOM_Sensor_Kit.WOM_servo360(pin10,360)

Parameter definition: WOM_servo360 (pin X, angle), drive the servo connected to pin P10 to rotate to 360 degrees, X can be modified to other pins, pay attention to keep the wiring consistent with the program. The range of angles is 0-360.

2. Official function of micro:bit

If you need to view the micropython library functions of the micro:bit, please visit the following link: https://microbit-micropython.readthedocs.io/en/v2-docs/

Note when writing codes:

1 - Case must be correct!

2 - Spelling must be strictly correct!

3 - There needs to be a space between keywords such as # and the content

4 - The program ends with a blank program line

 

Python Programming Guide
Introduction of module

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文