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