6、动态的火柴人
打开mpythonX,连接掌控板,打开文件管理,新建文件夹(命名为pbm),然后将转好的pbm文件一个一个的上传至掌控板。
#MicroPython动手做(16)——掌控板之图片图像显示
#动态的火柴人
from mpython import *
import time
image_picture = Image()
while True:
for i in range(8):
oled.fill(0)
oled.blit(image_picture.load(str(str("pbm/") + str((str(i)))) + str(".pbm"), 0), 0, 0)
oled.show()
time.sleep_ms(50)
mPython X 图形编程
7、OLED屏播放Bad Apple!!
#MicroPython动手做(16)——掌控板之图片图像显示
#OLED屏播放Bad Apple!!
from mpython import *
import time
image_picture = Image()
while True:
for i in range(75):
oled.fill(0)
oled.blit(image_picture.load(str(str("pbm/") + str((str(i)))) + str(".pbm"), 0), 0, 0)
oled.show()
time.sleep_ms(50)
mPython X 图形编程
8、A、B键控制图片转换显示
#MicroPython动手做(16)——掌控板之图片图像显示
#A、B键控制图片转换显示
from mpython import *
import music
def callback_button_a_pressed():
oled.fill(0)
bmp_wZZv = bytearray()
oled.Bitmap(0, 0, bmp_wZZv, 128, 64, 1)
oled.show()
def callback_button_b_pressed():
oled.fill(0)
bmp_h61P = bytearray()
oled.Bitmap(0, 0, bmp_h61P, 128, 64, 1)
oled.show()
def on_button_a_pressed():
while True:
if button_a.value() == 0:
yield callback_button_a_pressed()
else:
yield
def on_button_b_pressed():
while True:
if button_b.value() == 0:
yield callback_button_b_pressed()
else:
yield
func_button_a_pressed = on_button_a_pressed()
func_button_b_pressed = on_button_b_pressed()
while True:
next(func_button_a_pressed)
next(func_button_b_pressed)
Mind+ 图形编程
9、A、B按键调速的十帧动画片
使用掌控板上的两个按键控制动画播放的速度。按下A,速度减慢;按下B,速度加快。
Mind+ 图形编程
页:
1
[2]