驴友花雕 发表于 2020-4-23 18:59:16

mPython 图形编程


驴友花雕 发表于 2020-4-23 20:34:37


驴友花雕 发表于 2020-4-23 20:37:47

6、动态的火柴人
打开mpythonX,连接掌控板,打开文件管理,新建文件夹(命名为pbm),然后将转好的pbm文件一个一个的上传至掌控板。





驴友花雕 发表于 2020-4-23 20:41:25

#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)

驴友花雕 发表于 2020-4-23 20:49:37

mPython X 图形编程


驴友花雕 发表于 2020-4-23 20:55:51


驴友花雕 发表于 2020-4-23 21:41:09

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)

驴友花雕 发表于 2020-4-23 21:53:04

mPython X 图形编程


驴友花雕 发表于 2020-4-23 21:57:53


驴友花雕 发表于 2020-4-24 09:21:34

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)

驴友花雕 发表于 2020-4-24 09:31:51

Mind+ 图形编程


驴友花雕 发表于 2020-4-24 10:21:28


驴友花雕 发表于 2020-5-1 19:33:42

9、A、B按键调速的十帧动画片

使用掌控板上的两个按键控制动画播放的速度。按下A,速度减慢;按下B,速度加快。



驴友花雕 发表于 2020-5-1 19:42:42

Mind+ 图形编程


驴友花雕 发表于 2020-5-1 19:49:07





驴友花雕 发表于 2020-5-1 19:55:14


页: 1 [2]
查看完整版本: MicroPython动手做(16)——掌控板之图片图像显示