2019-1-16 23:35:40 [显示全部楼层]
3703浏览
查看: 3703|回复: 1

[入门教程] mpythonX:图文混搭更容易

[复制链接]
本帖最后由 rzegkly 于 2019-1-16 23:36 编辑

mpythonX:图文混搭更容易图1

冬天已经来了,春天会远吗?

mpythonX0.1.2更新了:

目标:mpythonX制作掌控板的图文混搭效果

1、一、 处理图片:

1、我们学校的校徽,利用美图秀秀将图片处理成54*54(校徽)分辨率的图片,
mpythonX:图文混搭更容易图2
2、利用取模工具对图片进行取模。网上有PCtoLCD、lcd image converter等取模软件,可根据自己喜好自行选择。以下使用的是Img2Lcd工具。
l 步骤1.导入刚才修改后的图片
l 步骤2.选择参数,输出数据类型[C语言数组]、扫描模式[水平扫描]、输出灰度[单色]、宽高[128*64](注意:一定要根据实际图片效果来调整亮度和对比度,已达到最佳显示效果)
l 步骤3.保存数据:点击保存,填写好文件名,自动会弹出图像的取模值。但是我们在使用的时候一定要注意:前面的注释部分(下图中的蓝色部分)不能写入一会儿的程序中。
三、图形块搭建

1、图形块列表建立,创建图标变量

mpythonX:图文混搭更容易图3

2、绘制图形块,添加图标变量mpython

mpythonX:图文混搭更容易图4

3、确定文字和图形位置

mpythonX:图文混搭更容易图5




四、代码块显示

[mw_shl_code=python,true]from mpython import *


xiaohui = [0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X1F,0XFC,0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,0X80,0X00,0X00,0X00,0X03,0XC0,0X03, 0XE0,0X00,0X00,0X00,0X0F,0X40,0XC0,0XF0,0X00,0X00,0X00,0X1C,0XE1,0XE3,0XB8,0X00, 0X00,0X00,0X38,0XE3,0XC3,0X0E,0X00,0X00,0X00,0X60,0XE0,0X03,0X07,0X00,0X00,0X00, 0XC0,0X60,0X03,0X83,0X80,0X00,0X01,0XB0,0X07,0XF1,0X0D,0X80,0X00,0X03,0XB8,0X1F, 0XFC,0X1E,0XC0,0X00,0X03,0X78,0X7F,0XFF,0X4E,0X60,0X00,0X06,0X05,0XF1,0XFF,0X84, 0X60,0X00,0X06,0X03,0XC0,0XFF,0XE4,0X30,0X00,0X0C,0X03,0XBC,0XFF,0X60,0X10,0X00, 0X0D,0X07,0XEE,0X7C,0XF0,0X18,0X00,0X19,0XEF,0XE2,0X79,0XF8,0XD8,0X00,0X1B,0X2F, 0XFF,0X23,0XF8,0XEC,0X00,0X1B,0X1F,0XFD,0X03,0XFC,0X6C,0X00,0X31,0X1F,0XFF,0X83, 0XFC,0X0C,0X00,0X30,0X3F,0XFF,0XC7,0XFC,0X0C,0X00,0X30,0X3F,0XFF,0XCF,0XFE,0X04, 0X00,0X30,0X3F,0XFF,0X9F,0XFE,0X06,0X00,0X36,0X3F,0XFF,0XBF,0XFE,0X26,0X00,0X37, 0X3F,0XFF,0X3F,0XFE,0X36,0X00,0X37,0X3E,0X7E,0X7F,0X3E,0XF6,0X00,0X37,0X3E,0X0E, 0X78,0X3E,0X36,0X00,0X30,0X3E,0X03,0X60,0X3E,0X06,0X00,0X30,0X3E,0X00,0X80,0X3E, 0X06,0X00,0X32,0X3F,0X00,0X00,0X7C,0X4C,0X00,0X33,0X1F,0X00,0X00,0X7C,0X6C,0X00, 0X13,0X1F,0XE0,0X03,0XFC,0X4C,0X00,0X1A,0X0F,0XFC,0X1F,0XF8,0XCC,0X00,0X1B,0X0F, 0XFF,0X7F,0XF8,0XD8,0X00,0X09,0X87,0XFF,0XFF,0XF1,0X98,0X00,0X0D,0XC3,0XFF,0XFF, 0XE1,0X98,0X00,0X0C,0XC3,0XFE,0XA7,0XC0,0X30,0X00,0X06,0X40,0XFE,0X87,0X83,0X30, 0X00,0X07,0X60,0X7F,0XFF,0X06,0X60,0X00,0X03,0X30,0X1F,0XFC,0X02,0XC0,0X00,0X01, 0X94,0X07,0XF0,0X39,0XC0,0X00,0X00,0XCF,0X00,0X00,0X31,0X80,0X00,0X00,0XE6,0X80, 0X00,0XF3,0X00,0X00,0X00,0X73,0XB4,0X03,0XCE,0X00,0X00,0X00,0X3C,0X24,0X4D,0X1C, 0X00,0X00,0X00,0X0E,0X2F,0XFC,0X78,0X00,0X00,0X00,0X07,0X80,0X01,0XE0,0X00,0X00, 0X00,0X01,0XF8,0X1F,0XC0,0X00,0X00,0X00,0X00,0X7F,0XFE,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,]
mpython = [0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X40,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0XC8,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X01,0X98,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X63,0X30,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X80,0X20,0X40,0X40,0X00, 0X00,0XC6,0X64,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X08,0X90,0X20,0X40,0X43,0XE0, 0X00,0XC6,0X64,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X08,0X90,0X20,0X40,0X43,0XE0, 0X01,0X8C,0XCC,0X00,0X07,0X80,0X0C,0XC0,0X00,0X00,0X1F,0XFC,0X23,0XF8,0X44,0X00, 0X03,0X19,0X98,0X00,0X07,0XC0,0X0C,0XC0,0X00,0X00,0X20,0X02,0XFC,0X09,0XF8,0X00, 0X06,0X13,0X30,0X00,0X04,0X60,0X0C,0XC0,0X00,0X00,0X2F,0XF2,0X24,0XA8,0X4F,0XE0, 0X04,0X10,0X60,0XFD,0XE4,0X78,0X5E,0XFC,0X7C,0XF8,0X08,0X08,0X21,0X30,0XC8,0X00, 0X0C,0X98,0XCC,0XC6,0X24,0XC8,0XCC,0XC4,0XC4,0XCC,0X07,0XF0,0X22,0X18,0X6A,0X20, 0X0B,0XCC,0X18,0XC6,0X37,0XCC,0X8C,0XC6,0X86,0X84,0X00,0X00,0X24,0X09,0X69,0X20, 0X08,0X86,0X30,0XC6,0X34,0X05,0X8C,0XC6,0X86,0X84,0X00,0X80,0X71,0XF1,0X79,0X40, 0X08,0X03,0X60,0XC6,0X34,0X07,0X8C,0XC6,0X86,0X84,0X1F,0XF8,0X20,0X41,0X58,0XC0, 0X0C,0X01,0XC0,0XC6,0X34,0X07,0X0C,0XC6,0XEC,0X84,0X00,0X80,0X20,0X41,0X48,0XC0, 0X04,0XCD,0X80,0X46,0X34,0X03,0X06,0XC4,0X38,0X84,0X3F,0XFE,0X20,0X41,0X49,0X60, 0X06,0X73,0X00,0X00,0X00,0X02,0X00,0X00,0X00,0X00,0X00,0X80,0X20,0X40,0X4A,0X20, 0X03,0X06,0X00,0X00,0X00,0X06,0X00,0X00,0X00,0X00,0X07,0X00,0XC7,0XF8,0X48,0X10, 0X01,0XFC,0X00,0X00,0X00,0X06,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,]
while True:
    oled.fill(0)
    oled.Bitmap(0, 0, mpython, 128, 32, 1)
    oled.DispChar('创新中国 有你有我', 20, 24)
    oled.DispChar('2019.中国 .汝州', 28, 38)
    sleep_ms(1000)
    oled.show()
    oled.fill(0)
    oled.Bitmap(8, 8, xiaohui, 54, 54, 1)
    oled.DispChar('小创客', 60, 16)
    oled.DispChar('大智慧', 88, 32)
    sleep_ms(1000)
    oled.show()[/mw_shl_code]

五、视频回放



rzyzzxw  版主

发表于 2019-1-17 08:43:17

赞。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
上海智位机器人股份有限公司 沪ICP备09038501号-4 备案 沪公网安备31011502402448

© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail