Meowbit MicroPython API
Meowbit MicroPython API
Import Meowbit library
Meowbit String Display
Meowbit support both English and Chinese characters.
Display English
Coordinates refer to top left o text.
ext is text size.
color is color, RGB is supported.
Display Chinese
Coordinates refer to top left o text.
ext is text size.
color: RGB is supported.
Sample Program
Meowbit Display Shapes
Screen Fill
Fill screen with color.
color: RGB is supported.
Draw Pixel
color: RGB is supported.
Draw Line
color: RGB is supported.
Sample Program
Draw Rectangle
Coordinates refer to top left.
color: RGB is supported.
fill = 1 to fill shape, fill = 0 for no fill.
Draw Circle
Coordinates refer to center.
color: RGB is supported.
fill = 1 to fill shape, fill = 0 for no fill.
Draw Triangle
color: RGB is supported.
fill = 1 to fill shape, fill = 0 for no fill.
Draw Polygon
Coordinates refer to center.
Sides: no. of side
th: thickness of the border
rot: rotation angle
color: RGB is supported.
fill = 1 to fill shape, fill = 0 for no fill.
Sample Program
Screen Refresh
Set Screen Auto Sync
Set to 1 to turn on scren sync, 0 to turn off
Sample Program
Meowbit Display Picture
Show bmp
path: file name
Coordinates refer to top left
Show gif
path: file name
Coordinates refer to top left
Sample Program
Meowbit Buttons
Get Button Status
btn: ’a’ , ’b’ , ’up’ , ’down’ , ’left’ , ’right’
Button Triggers
btn: ’a’ , ’b’ , ’up’ , ’down’ , ’left’ , ’right’
fn: function
startSchedule(): enable running in background
Sample Program
Meowbit LED
Turn On / Off
Toggle Switch
Brightness Control
Brightness: 0-255
Sample Program
Meowbit Buzzer
Buzzer Tone
freq: frequency, reference
delay: duration in seconds, -1 for infinite
Buzzer Note
note: 0~130
delay: duration in seconds, -1 for infinite
Buzzer Rest
delay: duration in seconds, -1 for infinite
Buzzer Melody
m: melody, in the format of m+octave:duration, r for rest
for example: “d5:1 b4:1” , “a3:2 r a3:2”
bpm: default 120
These melodies are built-in
CORRECT,NOTICE,ERROR
Buzzer Stop
Sample Program
Meowbit Sensors
Temperature Sensor
Light Sensor
Sample Program
Meowbit Accelerometer
Meowbit上有個3軸的陀螺儀,可以檢測加速度和傾斜度等的數值。
Acceleration Value
Unit: g(m/s^2)
Gyro Value
Unit: g(deg/s)
Roll Degree
Pitch Degree
Gesture
ges: ‘shake’, ‘freefall’, ‘tilt_up’, ‘tilt_down’, ‘tilt_left’, ‘tilt_right’, 'face_up’, ‘face_down’
Gesture Trigger
ges: ‘shake’, ‘freefall’, ‘tilt_up’, ‘tilt_down’, ‘tilt_left’, ‘tilt_right’, 'face_up’, ‘face_down’
fn: function
startSchedule(): enable trigger to run in background
Sample Program
GPIO
Initiate GPIO Pin mode
pin: P1-P20
mode:
IN: Digital In
OUT: Digital Out
ANALOG: Analog In
PWM: Analog Out
Digital Read
Analog Read
Digital Write
Analog Write
Sample Program
Last updated