rzyzzxw 发表于 2018-10-3 16:09:19

【掌控】mpython-8…我们一起摇啊摇,数码骰(tou)子

本帖最后由 rzyzzxw 于 2018-10-4 18:12 编辑

摇啊摇 摇啊摇 船儿摇到外婆桥
外婆好 外婆好 外婆对我嘻嘻笑
摇啊摇 摇啊摇 船儿摇到外婆桥
外婆好 外婆好 外婆对我嘻嘻笑
摇啊摇 摇啊摇 船儿摇到外婆桥
外婆说 好宝宝 外婆给我一块糕
摇啊摇 摇啊摇 船儿摇到外婆桥
外婆说 好宝宝 外婆给我一块糕

好吧,我们不去找外婆。
我们一起摇骰子,看看谁的点数大。

http://v.youku.com/v_show/id_XMzg0Nzk1NTE5Mg==.html?spm=a2h3j.8428770.3416059.1

【1】准备图片

【2】用图片取模工具


【3】改写程序(哈哈,就是改上午的程序)
#abs() 函数返回数字的绝对值。

from mpython import * #此库为掌控板内置传感器驱动
import random#随机数产生库
import time #导入时间库
import framebuf

#图片bitmap数组
bmp1 = bytearray([\
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XC0,0X00,0X00,0X00,
0X00,0X00,0X00,0X0F,0XF8,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0XFC,0X00,0X00,0X00,
0X00,0X00,0X00,0X7F,0XFE,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,0X00,0X00,0X00,
0X00,0X00,0X00,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,0X80,0X00,0X00,
0X00,0X00,0X01,0XFF,0XFF,0X80,0X00,0X00,0X00,0X00,0X01,0XFF,0XFF,0X80,0X00,0X00,
0X00,0X00,0X01,0XFF,0XFF,0X80,0X00,0X00,0X00,0X00,0X01,0XFF,0XFF,0X80,0X00,0X00,
0X00,0X00,0X00,0XFF,0XFF,0X80,0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,0X00,0X00,0X00,
0X00,0X00,0X00,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X7F,0XFF,0X00,0X00,0X00,
0X00,0X00,0X00,0X3F,0XFC,0X00,0X00,0X00,0X00,0X00,0X00,0X1F,0XFC,0X00,0X00,0X00,
0X00,0X00,0X00,0X07,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
])
# 1 该部分代码来自取模工具

fb1 = framebuf.FrameBuffer(bmp1,64,64, framebuf.MONO_HLSB)   #创建64x64大小帧缓存区储存图片帧,水平扫描

bmp2 = bytearray([\
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X3F,0X00,0X01,0XFC,0X00,0X00,0X00,0X00,0XFF,0XC0,0X03,0XFE,0X00,0X00,
0X00,0X00,0XFF,0XC0,0X07,0XFF,0X00,0X00,0X00,0X01,0XFF,0XE0,0X07,0XFF,0X80,0X00,
0X00,0X01,0XFF,0XE0,0X0F,0XFF,0X80,0X00,0X00,0X01,0XFF,0XE0,0X0F,0XFF,0X80,0X00,
0X00,0X01,0XFF,0XE0,0X0F,0XFF,0X80,0X00,0X00,0X01,0XFF,0XE0,0X0F,0XFF,0X80,0X00,
0X00,0X01,0XFF,0XE0,0X07,0XFF,0X80,0X00,0X00,0X01,0XFF,0XE0,0X07,0XFF,0X00,0X00,
0X00,0X00,0XFF,0XC0,0X03,0XFE,0X00,0X00,0X00,0X00,0X7F,0X80,0X01,0XFC,0X00,0X00,
0X00,0X00,0X1E,0X00,0X00,0X70,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
])
# 2 该部分代码来自取模工具

fb2 = framebuf.FrameBuffer(bmp2,64,64, framebuf.MONO_HLSB)   #创建64x64大小帧缓存区储存图片帧,水平扫描

bmp3 = bytearray([\
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XE0,0X00,0X00,0X00,0X00,0X00,
0X00,0X1F,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0XF8,0X00,0X00,0X00,0X00,0X00,
0X00,0X3F,0XFC,0X00,0X00,0X00,0X00,0X00,0X00,0X7F,0XFC,0X00,0X00,0X00,0X00,0X00,
0X00,0X7F,0XFC,0X00,0X00,0X00,0X00,0X00,0X00,0X7F,0XFC,0X00,0X00,0X00,0X00,0X00,
0X00,0X7F,0XFC,0X00,0X00,0X00,0X00,0X00,0X00,0X7F,0XFC,0X00,0X00,0X00,0X00,0X00,
0X00,0X3F,0XFC,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0XF8,0X00,0X00,0X00,0X00,0X00,
0X00,0X1F,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X0F,0XE0,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X03,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X0F,0XF8,0X00,0X00,0X00,
0X00,0X00,0X00,0X1F,0XFC,0X00,0X00,0X00,0X00,0X00,0X00,0X1F,0XFE,0X00,0X00,0X00,
0X00,0X00,0X00,0X3F,0XFE,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0XFE,0X00,0X00,0X00,
0X00,0X00,0X00,0X3F,0XFE,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0XFE,0X00,0X00,0X00,
0X00,0X00,0X00,0X3F,0XFE,0X00,0X00,0X00,0X00,0X00,0X00,0X1F,0XFE,0X00,0X00,0X00,
0X00,0X00,0X00,0X0F,0XFC,0X00,0X00,0X00,0X00,0X00,0X00,0X0F,0XF8,0X00,0X00,0X00,
0X00,0X00,0X00,0X03,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X60,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFC,0X00,
0X00,0X00,0X00,0X00,0X00,0X07,0XFE,0X00,0X00,0X00,0X00,0X00,0X00,0X0F,0XFF,0X00,
0X00,0X00,0X00,0X00,0X00,0X0F,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X1F,0XFF,0X80,
0X00,0X00,0X00,0X00,0X00,0X1F,0XFF,0X80,0X00,0X00,0X00,0X00,0X00,0X1F,0XFF,0X80,
0X00,0X00,0X00,0X00,0X00,0X1F,0XFF,0X80,0X00,0X00,0X00,0X00,0X00,0X0F,0XFF,0X00,
0X00,0X00,0X00,0X00,0X00,0X0F,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFE,0X00,
0X00,0X00,0X00,0X00,0X00,0X03,0XFC,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0XF8,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
])
# 3 该部分代码来自取模工具

fb3 = framebuf.FrameBuffer(bmp3,64,64, framebuf.MONO_HLSB)   #创建64x64大小帧缓存区储存图片帧,水平扫描

bmp4 = bytearray([\
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XF8,0X00,0X00,0X7E,0X00,0X00,
0X00,0X07,0XFC,0X00,0X00,0XFF,0X80,0X00,0X00,0X0F,0XFE,0X00,0X01,0XFF,0X80,0X00,
0X00,0X0F,0XFF,0X00,0X03,0XFF,0XC0,0X00,0X00,0X1F,0XFF,0X00,0X03,0XFF,0XC0,0X00,
0X00,0X1F,0XFF,0X00,0X03,0XFF,0XE0,0X00,0X00,0X1F,0XFF,0X00,0X03,0XFF,0XE0,0X00,
0X00,0X1F,0XFF,0X00,0X03,0XFF,0XC0,0X00,0X00,0X0F,0XFF,0X00,0X03,0XFF,0XC0,0X00,
0X00,0X0F,0XFE,0X00,0X03,0XFF,0XC0,0X00,0X00,0X07,0XFE,0X00,0X01,0XFF,0X80,0X00,
0X00,0X03,0XF8,0X00,0X00,0XFF,0X00,0X00,0X00,0X00,0XE0,0X00,0X00,0X3C,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XE0,0X00,0X00,0X38,0X00,0X00,
0X00,0X03,0XFC,0X00,0X00,0XFF,0X00,0X00,0X00,0X07,0XFE,0X00,0X01,0XFF,0X80,0X00,
0X00,0X0F,0XFE,0X00,0X03,0XFF,0X80,0X00,0X00,0X0F,0XFF,0X00,0X03,0XFF,0XC0,0X00,
0X00,0X1F,0XFF,0X00,0X07,0XFF,0XC0,0X00,0X00,0X1F,0XFF,0X00,0X07,0XFF,0XC0,0X00,
0X00,0X1F,0XFF,0X00,0X07,0XFF,0XC0,0X00,0X00,0X1F,0XFF,0X00,0X07,0XFF,0XC0,0X00,
0X00,0X0F,0XFF,0X00,0X03,0XFF,0X80,0X00,0X00,0X07,0XFE,0X00,0X03,0XFF,0X80,0X00,
0X00,0X07,0XFC,0X00,0X01,0XFF,0X00,0X00,0X00,0X01,0XF0,0X00,0X00,0X7C,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
])
# 4 该部分代码来自取模工具

fb4 = framebuf.FrameBuffer(bmp4,64,64, framebuf.MONO_HLSB)   #创建64x64大小帧缓存区储存图片帧,水平扫描

bmp5 = bytearray([\
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X80,0X00,0X00,0X00,0X00,0X00,
0X00,0X07,0XF0,0X00,0X00,0X1F,0X80,0X00,0X00,0X0F,0XF8,0X00,0X00,0X7F,0XE0,0X00,
0X00,0X1F,0XFC,0X00,0X00,0X7F,0XF0,0X00,0X00,0X1F,0XFE,0X00,0X00,0XFF,0XF0,0X00,
0X00,0X3F,0XFE,0X00,0X00,0XFF,0XF8,0X00,0X00,0X3F,0XFE,0X00,0X00,0XFF,0XF8,0X00,
0X00,0X3F,0XFE,0X00,0X00,0XFF,0XF8,0X00,0X00,0X3F,0XFE,0X00,0X00,0XFF,0XF8,0X00,
0X00,0X1F,0XFE,0X00,0X00,0XFF,0XF0,0X00,0X00,0X1F,0XFC,0X00,0X00,0X7F,0XF0,0X00,
0X00,0X0F,0XF8,0X00,0X00,0X7F,0XE0,0X00,0X00,0X07,0XF0,0X00,0X00,0X3F,0XC0,0X00,
0X00,0X03,0XE0,0X00,0X00,0X0F,0X80,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X1F,0XE0,0X00,0X00,0X00,
0X00,0X00,0X00,0X1F,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0XF8,0X00,0X00,0X00,
0X00,0X00,0X00,0X7F,0XF8,0X00,0X00,0X00,0X00,0X00,0X00,0X7F,0XFC,0X00,0X00,0X00,
0X00,0X00,0X00,0X7F,0XFC,0X00,0X00,0X00,0X00,0X00,0X00,0X7F,0XFC,0X00,0X00,0X00,
0X00,0X00,0X00,0X7F,0XFC,0X00,0X00,0X00,0X00,0X00,0X00,0X7F,0XF8,0X00,0X00,0X00,
0X00,0X00,0X00,0X3F,0XF8,0X00,0X00,0X00,0X00,0X00,0X00,0X1F,0XF0,0X00,0X00,0X00,
0X00,0X00,0X00,0X1F,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XE0,0X00,0X00,0X0F,0X80,0X00,
0X00,0X07,0XF0,0X00,0X00,0X3F,0XC0,0X00,0X00,0X1F,0XFC,0X00,0X00,0X7F,0XE0,0X00,
0X00,0X1F,0XFC,0X00,0X00,0XFF,0XF0,0X00,0X00,0X3F,0XFE,0X00,0X00,0XFF,0XF0,0X00,
0X00,0X3F,0XFE,0X00,0X00,0XFF,0XF8,0X00,0X00,0X3F,0XFE,0X00,0X00,0XFF,0XF8,0X00,
0X00,0X3F,0XFE,0X00,0X00,0XFF,0XF8,0X00,0X00,0X3F,0XFE,0X00,0X00,0XFF,0XF8,0X00,
0X00,0X1F,0XFE,0X00,0X00,0XFF,0XF0,0X00,0X00,0X1F,0XFC,0X00,0X00,0X7F,0XF0,0X00,
0X00,0X0F,0XF8,0X00,0X00,0X7F,0XE0,0X00,0X00,0X07,0XF0,0X00,0X00,0X1F,0X80,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
])
# 5 该部分代码来自取模工具

fb5 = framebuf.FrameBuffer(bmp5,64,64, framebuf.MONO_HLSB)   #创建64x64大小帧缓存区储存图片帧,水平扫描

bmp6 = bytearray([\
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X1F,0X00,0X00,0XF8,0X00,0X00,
0X00,0X00,0X7F,0X80,0X03,0XFC,0X00,0X00,0X00,0X00,0XFF,0XC0,0X07,0XFE,0X00,0X00,
0X00,0X00,0XFF,0XE0,0X07,0XFF,0X00,0X00,0X00,0X01,0XFF,0XE0,0X0F,0XFF,0X80,0X00,
0X00,0X01,0XFF,0XF0,0X0F,0XFF,0X80,0X00,0X00,0X01,0XFF,0XF0,0X0F,0XFF,0X80,0X00,
0X00,0X01,0XFF,0XF0,0X0F,0XFF,0X80,0X00,0X00,0X01,0XFF,0XE0,0X0F,0XFF,0X80,0X00,
0X00,0X01,0XFF,0XE0,0X07,0XFF,0X00,0X00,0X00,0X00,0XFF,0XC0,0X07,0XFE,0X00,0X00,
0X00,0X00,0X7F,0X80,0X03,0XFE,0X00,0X00,0X00,0X00,0X1F,0X00,0X00,0XF8,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X1F,0X00,0X00,0XF8,0X00,0X00,0X00,0X00,0X7F,0XC0,0X03,0XFE,0X00,0X00,
0X00,0X00,0XFF,0XE0,0X07,0XFE,0X00,0X00,0X00,0X01,0XFF,0XE0,0X07,0XFF,0X00,0X00,
0X00,0X01,0XFF,0XE0,0X0F,0XFF,0X80,0X00,0X00,0X01,0XFF,0XF0,0X0F,0XFF,0X80,0X00,
0X00,0X01,0XFF,0XF0,0X0F,0XFF,0X80,0X00,0X00,0X01,0XFF,0XF0,0X0F,0XFF,0X80,0X00,
0X00,0X01,0XFF,0XE0,0X0F,0XFF,0X80,0X00,0X00,0X00,0XFF,0XE0,0X07,0XFF,0X00,0X00,
0X00,0X00,0XFF,0XC0,0X07,0XFE,0X00,0X00,0X00,0X00,0X7F,0X80,0X01,0XFC,0X00,0X00,
0X00,0X00,0X1E,0X00,0X00,0XF8,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0X80,0X01,0XFC,0X00,0X00,
0X00,0X00,0X7F,0XC0,0X03,0XFE,0X00,0X00,0X00,0X00,0XFF,0XE0,0X07,0XFF,0X00,0X00,
0X00,0X01,0XFF,0XE0,0X0F,0XFF,0X00,0X00,0X00,0X01,0XFF,0XE0,0X0F,0XFF,0X80,0X00,
0X00,0X01,0XFF,0XF0,0X0F,0XFF,0X80,0X00,0X00,0X01,0XFF,0XF0,0X0F,0XFF,0X80,0X00,
0X00,0X01,0XFF,0XE0,0X0F,0XFF,0X80,0X00,0X00,0X01,0XFF,0XE0,0X0F,0XFF,0X00,0X00,
0X00,0X00,0XFF,0XE0,0X07,0XFF,0X00,0X00,0X00,0X00,0X7F,0XC0,0X03,0XFE,0X00,0X00,
0X00,0X00,0X3F,0X80,0X01,0XFC,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
])
# 6 该部分代码来自取模工具

fb6 = framebuf.FrameBuffer(bmp6,64,64, framebuf.MONO_HLSB)   #创建64x64大小帧缓存区储存图片帧,水平扫描

while True:
    x1 = accelerometer.get_x()
    y1 = accelerometer.get_y()
    z1 = accelerometer.get_z()
    time.sleep_ms(100)
    x2 = accelerometer.get_x()
    y2 = accelerometer.get_y()
    z2 = accelerometer.get_z()
    if abs(x1 - x2) > 0.5 or abs(y1 - y2) > 0.5 or abs(z1 - z2) > 0.5:
      #任意一轴的分时差值超过0.5,则认为检测到摇动
      display.fill(0) #清屏,以清掉以前显示数据
      display.show()#刷新
      num = random.randint(1,6)#随机产生1-3的数
      #display.DispChar(str(num),20,25,1) #产生的随机数送显示缓存
      #display.show() #数据送ODED显示
      if num == 1:
            display.blit(fb1,32,0)#将fb1帧缓存送至oled显示,起始位(32,0)
            display.show()         #刷新显示屏
      elif num == 2:
            display.blit(fb2,32,0)#将fb2帧缓存送至oled显示,起始位(32,0)
            display.show()         #刷新显示屏
      elif num == 3:
            display.blit(fb3,32,0)#将fb3帧缓存送至oled显示,起始位(32,0)
            display.show()         #刷新显示屏
      elif num == 4:
            display.blit(fb4,32,0)#将fb4帧缓存送至oled显示,起始位(32,0)
            display.show()         #刷新显示屏
      elif num == 5:
            display.blit(fb5,32,0)#将fb5帧缓存送至oled显示,起始位(32,0)
            display.show()         #刷新显示屏
      elif num == 6:
            display.blit(fb6,32,0)#将fb6帧缓存送至oled显示,起始位(32,0)
            display.show()         #刷新显示屏
    time.sleep_ms(100)

刷入板子,设为默认运行。
运行它,可以玩了。

来来来,比比谁点大。

俗人 发表于 2018-10-4 15:08:59

厉害厉害666

王玉英 发表于 2019-8-7 18:47:01

真棒!!!
页: [1]
查看完整版本: 【掌控】mpython-8…我们一起摇啊摇,数码骰(tou)子