在 Adafruit Circuit Playground Tri-Color E-Ink Gizmo 上显示社区的Logo。
显示效果(因为黄色无法显示,所以换成了红色):
在三色 E-Ink Gizmo 上显示社区 logo
- shaoziyang
- 帖子: 3917
- 注册时间: 2019年 10月 21日 13:48
Re: 在三色 E-Ink Gizmo 上显示社区 logo
参考程序
- 需要先将Logo转换为bmp图片并上传到circuit playground开发板
- 下载并安装下面的库文件到开发板的lib目录
- adafruit_il0373.mpy
- adafruit_ssd1681.mpy
- adafruit_gizmo
Code: Select all
import time
import displayio
from adafruit_gizmo import eink_gizmo
display = eink_gizmo.EInk_Gizmo()
# Use the below line instead for the 200x200 E-Ink Gizmo
# display = eink_gizmo.EInk_HD_Gizmo()
# Create a display group for our screen objects
display_group = displayio.Group()
# Display a ruler graphic from the root directory of the CIRCUITPY drive
file = open("/mpycn.bmp", "rb")
picture = displayio.OnDiskBitmap(file)
# Create a Tilegrid with the bitmap and put in the displayio group
sprite = displayio.TileGrid(picture, pixel_shader=displayio.ColorConverter())
display_group.append(sprite)
# Place the display group on the screen
display.show(display_group)
# Refresh the display to have it actually show the image
# NOTE: Do not refresh eInk displays sooner than 180 seconds
display.refresh()
- shaoziyang
- 帖子: 3917
- 注册时间: 2019年 10月 21日 13:48
Re: 在三色 E-Ink Gizmo 上显示社区 logo
做了简单修改,上电后随机选择一个图片。
代码: 全选
import random
import displayio
from adafruit_gizmo import eink_gizmo
display = eink_gizmo.EInk_Gizmo()
# Use the below line instead for the 200x200 E-Ink Gizmo
# display = eink_gizmo.EInk_HD_Gizmo()
# Create a display group for our screen objects
display_group = displayio.Group()
# Display a ruler graphic from the root directory of the CIRCUITPY drive
file = open("/logo"+str(random.randint(1, 10))+".bmp", "rb")
picture = displayio.OnDiskBitmap(file)
# Create a Tilegrid with the bitmap and put in the displayio group
sprite = displayio.TileGrid(picture, pixel_shader=displayio.ColorConverter())
display_group.append(sprite)
# Place the display group on the screen
display.show(display_group)
# Refresh the display to have it actually show the image
# NOTE: Do not refresh eInk displays sooner than 180 seconds
display.refresh()
-
- 随机主题
- 回复总数
- 阅读次数
- 最新文章
-
- 1回复总数
- 3858 阅读次数
- 最新文章 由 shaoziyang
2019年 10月 31日 21:04
-
- 1回复总数
- 2144 阅读次数
- 最新文章 由 shaoziyang
2019年 10月 31日 21:05
-
- 1回复总数
- 2434 阅读次数
- 最新文章 由 shaoziyang
2019年 10月 31日 21:07