在三色 E-Ink Gizmo 上显示社区 logo

Adafruit CircuitPython相关
MicroPython重要分支
回复
头像
shaoziyang
帖子: 3917
注册时间: 2019年 10月 21日 13:48

在三色 E-Ink Gizmo 上显示社区 logo

#1

帖子 shaoziyang »

在 Adafruit Circuit Playground Tri-Color E-Ink Gizmo  上显示社区的Logo。

显示效果(因为黄色无法显示,所以换成了红色):
elink-logo.jpg
elink-logo.jpg (62.71 KiB) 查看 2667 次
 
 
 

头像
shaoziyang
帖子: 3917
注册时间: 2019年 10月 21日 13:48

Re: 在三色 E-Ink Gizmo 上显示社区 logo

#2

帖子 shaoziyang »

参考程序
  • 需要先将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

#3

帖子 shaoziyang »

做了简单修改,上电后随机选择一个图片。

代码: 全选

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

回复

  • 随机主题
    回复总数
    阅读次数
    最新文章