Tinybit MicroPython API
www.yahboom.com
Yahboom Tiny:bit MicroPython API
Input this code to import Yahboom Tiny:bit Micropython library:import tinybit
1、Car advance tinybit.car_HeadRGB(a, b, c)
Description of Parameter:
a is red value,range is 0‐255.
b is green value,range is 0‐255.
c is blue value,range is 0‐255.
Eg: tinybit.car_HeadRGB(255, 255, 255) //The RGB search light will becomewhite
2、Car advance
method1: tinybit.car_run(s)
method2: tinybit.car_run(a, b)
Function: Control the car advance
One parameter:
A single parameter s, set the speed of the two motors of the car, range: 0 ~ 255
Two parameters:
a is left motor speed,range is 0‐255.
b is right motor speed,range is 0‐255.
Eg1: tinybit.car_run(255) // The car will run with 255 speed
Eg2: tinybit.car_run(255, 255) // The car will run with 255 speed
3、Car back
method1: tinybit.car_back(a)
method2: tinybit.car_back(a, b)
Function: Control the car back
One parameter:
A single parameter s is the speed of the two motors of the car, range: 0 ~ 255
Two parameters:
a is left motor speed,range is 0‐255.
b is right motor speed,range is 0‐255.
Eg1: tinybit.car_back(255) // The car will back with 255 speed
Eg2: tinybit.car_back(255, 255) //The car will back with 255 speed
4、Car turn left tinybit.car_left(a)
Function: Control the car turn left
Parameter:
a is the speed of right motor of the car, range: 0 ~ 255
!Note: car turn left is left wheel stop and right wheel advance,so we only input right
speed.
Eg: tinybit.car_left(255) // The car will turn left with 255 speed
5、Car turn right tinybit.car_right(a)
Function: Control the car turn right