91欧美超碰AV自拍|国产成年人性爱视频免费看|亚洲 日韩 欧美一厂二区入|人人看人人爽人人操aV|丝袜美腿视频一区二区在线看|人人操人人爽人人爱|婷婷五月天超碰|97色色欧美亚州A√|另类A√无码精品一级av|欧美特级日韩特级

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評(píng)論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線(xiàn)課程
  • 觀看技術(shù)視頻
  • 寫(xiě)文章/發(fā)帖/加入社區(qū)
會(huì)員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識(shí)你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

怎樣通過(guò)CircuitPython使用Adafruit eInk / ePaper顯示屏

454398 ? 來(lái)源:網(wǎng)絡(luò)整理 ? 作者:網(wǎng)絡(luò)整理 ? 2019-11-27 10:12 ? 次閱讀
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

概述

怎樣通過(guò)CircuitPython使用Adafruit eInk / ePaper顯示屏

本指南旨在幫助您通過(guò)CircuitPython快速使用Adafruit 2.13“三色電子墨水FeatherWing和2.7”三色電子墨水屏蔽。

這些顯示器已經(jīng)帶有標(biāo)題焊接-屏蔽型的公頭和羽毛型的母頭。這使它們無(wú)需焊接即可插入各自的微控制器。放在微控制器上,上傳代碼和圖形文件,然后顯示!

刷新時(shí)間

大多數(shù)LCD,OLEDLED顯示屏都可以很快地寫(xiě)入,這有助于輕松地移動(dòng)圖形和顏色。

對(duì)于eInk顯示屏, 不是這種情況。擦除圖像涉及向顯示器發(fā)送特殊信號(hào),以“消除”彩色像素的顯示。 Adafruit建議不要每隔180秒(3分鐘)刷新一次這些顯示器。

如果將它們更快地寫(xiě)入,則可能會(huì)損壞顯示器。損壞的顯示器可能會(huì)永久打開(kāi)或關(guān)閉像素或出現(xiàn)其他異常情況,從而使保修無(wú)效。

電子墨水顯示器即使在關(guān)閉電源的情況下仍會(huì)繼續(xù)顯示圖像。如果您想要一個(gè)相當(dāng)靜態(tài)的圖像(例如圖片或名片),則eInk很棒。

如果您想要清晰,很少變化的顯示,則eInk很棒。有關(guān)快速變化的信息,請(qǐng)考慮使用其他類(lèi)型的顯示器,例如TFT或OLED。

零件 羽毛形狀因數(shù)

Adafruit Feather M4 Express-配備ATSAMD51

產(chǎn)品編號(hào):3857

這就是您一直期待的配備ATSAMD51的Feather M4 Express。這羽羽毛像迅捷一樣迅捷,像貓頭鷹一樣聰明,像牛鳥(niǎo)一樣強(qiáng)壯(它是半牛,……

$ 22.95

庫(kù)存

添加到購(gòu)物車(chē)

Adafruit 2.13英寸三色電子墨水/電子紙顯示屏FeatherWing

產(chǎn)品ID:4128

簡(jiǎn)單的電子紙終于出現(xiàn)在您的Feather上,旨在輕松添加三色eInk顯示器的突破口,您可能已經(jīng)看到其中一種。..

$ 24.95

入庫(kù)存

添加到購(gòu)物車(chē)

Metro Form Factor

/div》

Adafruit Metro M4特性Microchip ATSAMD51

產(chǎn)品ID:3382

您準(zhǔn)備好了嗎?真的準(zhǔn)備好了嗎?這是有史以來(lái)最快,功能最強(qiáng)大的Metro。AdafruitMetro M4具有Microchip ATSAMD51。這。..

$ 27.50

入庫(kù)價(jià)

添加到購(gòu)物車(chē)

Adafruit帶有SRAM的2.7英寸三色eInk/ePaper防護(hù)罩

產(chǎn)品ID:4229

易于使用的電子紙終于出現(xiàn)在微控制器上,這一突破旨在使其輕而易舉地添加三色電子墨水顯示屏。您可能已經(jīng)看過(guò)其中之一。..

$ 39.95

入庫(kù)存

添加到購(gòu)物車(chē)

編程

如果USB數(shù)據(jù)加電源線(xiàn)的一端適合您的計(jì)算機(jī),而另一端具有micro B連接器,則可以使用。下面的一個(gè)是最喜歡的,但可以根據(jù)需要選擇自己的一個(gè)。

粉紅色和紫色編織的USB A到Micro B電纜-2米長(zhǎng)

產(chǎn)品ID:4148

該電纜非常流行,具有編織的粉紅色和紫色Blinka圖案。封面和包覆成型。我們將這些顏色制成自定義顏色,。..

$ 3.95

入庫(kù)存

添加到購(gòu)物車(chē)

2.13英寸三色電子墨水羽翼

eInk FeatherWIng非常易于使用。它的背面有SD卡分線(xiàn),母頭連接到Feather微控制器。

與羽毛微控制器的連接 《對(duì)于具有大量?jī)?nèi)存的快速芯片,示例將其與Adafruit Feather M4 Express微控制器一起使用。目前,該板帶有未焊接的接頭。

2.7英寸三色電子墨水盾

此顯示器采用Arduino屏蔽形式,非常易于使用,背面具有SD卡分線(xiàn),公頭可插入Metro尺寸微控制器。

與Metro微控制器的連接

對(duì)于具有大量?jī)?nèi)存的快速芯片,本示例將此顯示器與Adafruit Metro M4 Express微控制器一起使用,屏蔽層應(yīng)插入帶有插頭的Metro M4中。如果您的Metro沒(méi)有母頭,請(qǐng)焊接它們。

CircuitPython和庫(kù)設(shè)置

編程

該CircuitPython指南中的所有快速入門(mén)示例均使用CircuitPython 5.0及更高版本中的新displayio驅(qū)動(dòng)程序。該代碼提供了強(qiáng)大的屏幕合成功能,并且已經(jīng)過(guò)優(yōu)化。雖然有使用舊版adafruit_epd方法的CircuitPython代碼示例,但將來(lái)會(huì)使用displayio。

在Feather上更新CircuitPython

您應(yīng)該檢查Feather上運(yùn)行的CircuitPython的版本。使用已知的優(yōu)質(zhì)數(shù)據(jù)+電源USB電纜將開(kāi)發(fā)板插入計(jì)算機(jī)。該板應(yīng)該顯示為名為 CIRCUITPY 的計(jì)算機(jī)上的磁盤(pán)驅(qū)動(dòng)器。

打開(kāi) boot_out.txt 。這將向您顯示電路板已加載的CircuitPython的版本。

下載:文件

復(fù)制代碼

Adafruit CircuitPython 5.0.0-alpha.4 on 2019-09-15; Adafruit Feather M4 Express with samd51j19 Adafruit CircuitPython 5.0.0-alpha.4 on 2019-09-15; Adafruit Feather M4 Express with samd51j19

displayio需要CircuitPython 5或更高版本。如果您的電路板運(yùn)行的是CircuitPython的較低版本,則需要對(duì)其進(jìn)行更新。為您的電路板升級(jí)到最新版本的Adafruit CircuitPython。

必需的CircuitPython庫(kù)

要顯示帶有displayio的位圖,只有一個(gè)必需的庫(kù),但這取決于您使用的顯示。

首先,確保為您的電路板運(yùn)行最新版本的Adafruit CircuitPython。

接下來(lái),您需要安裝必要的庫(kù)才能使用硬件。仔細(xì)按照以下步驟從Adafruit的CircuitPython庫(kù)捆綁包中查找并安裝該庫(kù)。我們的簡(jiǎn)介指南上有一個(gè)很棒的頁(yè)面,介紹如何為Express和非Express板安裝庫(kù)捆綁包。

由于捆綁包中的庫(kù)數(shù)量眾多,建議您從以下位置手動(dòng)安裝必要的庫(kù)捆綁包。第一個(gè)庫(kù)取決于您使用的eInk顯示器:

羽毛和2.13“三色eInk顯示器

adafruit_IL0373

Metro和2.7英寸三色電子墨水顯示屏

adafruit_il91874

接下來(lái),獲得以下信息用于在displayio顯示器上顯示文本的庫(kù)。它用于第二個(gè)和第三個(gè)示例。

adafruit_display_text

在繼續(xù)之前,請(qǐng)確保您董事會(huì)的 lib 文件夾具有正確的驅(qū)動(dòng)程序文件和 adafruit_display_text 庫(kù)已復(fù)制。

示例:?jiǎn)蝹€(gè)位圖

第一個(gè)示例讀取放置在電路板 CIRCUITPY 驅(qū)動(dòng)器上的位圖圖像,并將其顯示在eInk顯示屏上。

圖像

本示例中使用的圖像是CircuitPython文本圖像,顯示了各種元素。您可以通過(guò)單擊下面的綠色按鈕下載它。

display-ruler.bmp

用于制作自己的圖形,使其可以在三種顏色上顯示得體在這些顯示器上可用,請(qǐng)參閱指南為電子墨水顯示器準(zhǔn)備圖形。

如果圖片大于顯示器的寬度和高度,則其余部分將被截?cái)喽伙@示。建議您在使用圖像編輯器之前先縮放圖像,因?yàn)榇a不會(huì)縮放位圖。

將要使用的位圖縮放到圖像編輯器和抖動(dòng)中的顯示寬度和高度,否則僅使用黑色/白色/紅色。該代碼無(wú)法對(duì)位圖文件執(zhí)行圖像縮放。

代碼

下面的代碼將在主板的閃存驅(qū)動(dòng)器(在 CIRCUITPY 根目錄中)上放置一個(gè)位圖,并將其顯示在eInk顯示屏上。請(qǐng)參閱代碼中的注釋?zhuān)粤私饷總€(gè)步驟如何有助于該過(guò)程。

請(qǐng)選擇特定于顯示器和微控制器的代碼,因?yàn)橐韵聝蓚€(gè)代碼塊對(duì)兩組硬件均不可互換。這些示例幾乎完全相同。

2.13“ eink FeatherWing示例

圖釘反映了FeatherWing eInk顯示器和Feather M4的組合。它還具有2.13英寸顯示器的像素尺寸。

下載:Zip 或 il91874_simpletest.py | 在Github上查看

復(fù)制代碼

“”“

Simple test script for 2.7” 264x176 Tri-Color display shield

Supported products:

* Adafruit 2.7“ Tri-Color ePaper Display Shield

https://www.adafruit.com/product/4229

This program only requires the adafruit_il91874 library in /lib

for CircuitPython 5.0 and above which has displayio support.

”“”

import time

import board

import displayio

import adafruit_il91874

# Used to ensure the display is free in CircuitPython

displayio.release_displays()

# Define the pins needed for display use on the Metro

spi = board.SPI()

epd_cs = board.D10

epd_dc = board.D9

# Create the displayio connection to the display pins

display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs,

baudrate=1000000)

time.sleep(1) # Wait a bit

# Create the display object - the third color is red (0xff0000)

display = adafruit_il91874.IL91874(display_bus, width=264, height=176,

highlight_color=0xff0000, rotation=90)

# Create a display group for our screen objects

g = displayio.Group()

# Display a ruler graphic from the root directory of the CIRCUITPY drive

f = open(“/display-ruler.bmp”, “rb”)

pic = displayio.OnDiskBitmap(f)

# Create a Tilegrid with the bitmap and put in the displayio group

t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())

g.append(t)

# Place the display group on the screen (does not refresh)

display.show(g)

# Show the image on the display

display.refresh()

print(“refreshed”)

# Do Not refresh the screen more often than every 180 seconds

# for eInk displays! Rapid refreshes will damage the panel.

time.sleep(180)

“”“

Simple test script for 2.7” 264x176 Tri-Color display shield

Supported products:

* Adafruit 2.7“ Tri-Color ePaper Display Shield

https://www.adafruit.com/product/4229

This program only requires the adafruit_il91874 library in /lib

for CircuitPython 5.0 and above which has displayio support.

”“”

import time

import board

import displayio

import adafruit_il91874

# Used to ensure the display is free in CircuitPython

displayio.release_displays()

# Define the pins needed for display use on the Metro

spi = board.SPI()

epd_cs = board.D10

epd_dc = board.D9

# Create the displayio connection to the display pins

display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs,

baudrate=1000000)

time.sleep(1) # Wait a bit

# Create the display object - the third color is red (0xff0000)

display = adafruit_il91874.IL91874(display_bus, width=264, height=176,

highlight_color=0xff0000, rotation=90)

# Create a display group for our screen objects

g = displayio.Group()

# Display a ruler graphic from the root directory of the CIRCUITPY drive

f = open(“/display-ruler.bmp”, “rb”)

pic = displayio.OnDiskBitmap(f)

# Create a Tilegrid with the bitmap and put in the displayio group

t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())

g.append(t)

# Place the display group on the screen (does not refresh)

display.show(g)

# Show the image on the display

display.refresh()

print(“refreshed”)

# Do Not refresh the screen more often than every 180 seconds

# for eInk displays! Rapid refreshes will damage the panel.

time.sleep(180)

2.7“ eInk Shield示例

這些引腳反映了屏蔽eInk顯示屏和Metro M4的組合。它還具有2.7英寸顯示屏的像素尺寸。

下載:Project Zip 或 il0373_2.13_color.py | 在Github上查看

復(fù)制代碼

“”“Simple test script for Adafruit 2.13” 212x104 tri-color display

Supported products:

* Adafruit 2.13“ Tri-Color Display Breakout

* https://www.adafruit.com/product/4086 (breakout) or

* https://www.adafruit.com/product/4128 (FeatherWing)

”“”

import time

import board

import displayio

import adafruit_il0373

# Used to ensure the display is free in CircuitPython

displayio.release_displays()

# Define the pins needed for display use

# This pinout is for a Feather M4 and may be different for other boards

spi = board.SPI() # Uses SCK and MOSI

epd_cs = board.D9

epd_dc = board.D10

epd_reset = board.D5

epd_busy = board.D6

# Create the displayio connection to the display pins

display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs,

reset=epd_reset, baudrate=1000000)

time.sleep(1) # Wait a bit

# Create the display object - the third color is red (0xff0000)

display = adafruit_il0373.IL0373(display_bus, width=212, height=104,

rotation=90, busy_pin=epd_busy,

highlight_color=0xff0000)

# Create a display group for our screen objects

g = displayio.Group()

# Display a ruler graphic from the root directory of the CIRCUITPY drive

f = open(“/display-ruler.bmp”, “rb”)

pic = displayio.OnDiskBitmap(f)

# Create a Tilegrid with the bitmap and put in the displayio group

t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())

g.append(t)

# Place the display group on the screen

display.show(g)

# Refresh the display to have it actually show the image

# NOTE: Do not refresh eInk displays sooner than 180 seconds

display.refresh()

print(“refreshed”)

time.sleep(180)

“”“Simple test script for Adafruit 2.13” 212x104 tri-color display

Supported products:

* Adafruit 2.13“ Tri-Color Display Breakout

* https://www.adafruit.com/product/4086 (breakout) or

* https://www.adafruit.com/product/4128 (FeatherWing)

”“”

import time

import board

import displayio

import adafruit_il0373

# Used to ensure the display is free in CircuitPython

displayio.release_displays()

# Define the pins needed for display use

# This pinout is for a Feather M4 and may be different for other boards

spi = board.SPI() # Uses SCK and MOSI

epd_cs = board.D9

epd_dc = board.D10

epd_reset = board.D5

epd_busy = board.D6

# Create the displayio connection to the display pins

display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs,

reset=epd_reset, baudrate=1000000)

time.sleep(1) # Wait a bit

# Create the display object - the third color is red (0xff0000)

display = adafruit_il0373.IL0373(display_bus, width=212, height=104,

rotation=90, busy_pin=epd_busy,

highlight_color=0xff0000)

# Create a display group for our screen objects

g = displayio.Group()

# Display a ruler graphic from the root directory of the CIRCUITPY drive

f = open(“/display-ruler.bmp”, “rb”)

pic = displayio.OnDiskBitmap(f)

# Create a Tilegrid with the bitmap and put in the displayio group

t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())

g.append(t)

# Place the display group on the screen

display.show(g)

# Refresh the display to have it actually show the image

# NOTE: Do not refresh eInk displays sooner than 180 seconds

display.refresh()

print(“refreshed”)

time.sleep(180)

代碼查看

有關(guān)使用對(duì)于使用CircuitPython進(jìn)行顯示,出色的指南CircuitPython顯示支持使用displayio是您的第一站。如果您想更深入地了解用于顯示器的模型,請(qǐng)參閱本指南。

Adafruit建議在嘗試執(zhí)行其他代碼以確保將顯示器連接至顯示器之前,使用 displayio函數(shù)。硬件是由CircuitPython發(fā)行的。

下一步是讓微控制器知道顯示器上使用了哪些引腳。所使用的銷(xiāo)釘非常依賴(lài)于顯示器,建議在尋求更換之前,先參考顯示器上的指南以了解已知的有效工作配置。 displayio.release_displays設(shè)置與顯示總線(xiàn)的displayio.FourWire連接。

通過(guò)總線(xiàn),程序?qū)⒔⑴c顯示驅(qū)動(dòng)程序的連接。給出了顯示的大?。╠isplayio和width),方向(height),忙碌引腳和突出顯示顏色。對(duì)于此三色顯示,指定了紅色(rotation)。

其余代碼遵循標(biāo)準(zhǔn)的0xff0000顯示設(shè)置和使用:

創(chuàng)建顯示組

打開(kāi)要在顯示器上放置的位圖

創(chuàng)建位圖對(duì)象

創(chuàng)建一個(gè)TileGrid以使用位圖放置對(duì)象,并將圖塊組附加到顯示組

在屏幕上顯示顯示

刷新屏幕

最后,程序等待至少3分鐘。然后,程序?qū)⑼瓿刹⑥D(zhuǎn)到REPL。如果位圖應(yīng)保留在屏幕上,請(qǐng)?jiān)诔绦蚰┪蔡砑觗isplayio和while True:語(yǔ)句。

示例:簡(jiǎn)單文本

此示例在eInk顯示屏上顯示文本,可以說(shuō)是eInk的“ Hello World”。文本可以放在任何地方并縮放更大。

代碼

下面的代碼將使用內(nèi)部terminalio字體在eInk顯示屏上顯示一行文本。您可以設(shè)置前景色和背景色。請(qǐng)參閱注釋以了解每個(gè)步驟如何對(duì)過(guò)程作出貢獻(xiàn)。

請(qǐng)選擇特定于顯示器和微控制器的代碼,因?yàn)橐韵聝蓚€(gè)代碼塊對(duì)于兩組硬件均不可互換。這些示例幾乎完全相同。

2.13“ eink FeatherWing示例

圖釘反映了FeatherWing eInk顯示器和Feather M4的組合。它還具有2.13英寸顯示器的像素尺寸。

下載:Project Zip 或 213_tricolor_eink_fw_text.py | 在Github上查看

復(fù)制代碼

“”“

Simple text script for Adafruit 2.13” 212x104 tri-color display

Supported products:

* Adafruit 2.13“ Tri-Color Display Breakout

* Adafruit 2.13” Tri-Color Display FeatherWing

https://www.adafruit.com/product/4086 (breakout) or

https://www.adafruit.com/product/4128 (FeatherWing)

This program requires the adafruit_il0373 library and the

adafruit_display_text library in the CIRCUITPY /lib folder

for CircuitPython 5.0 and above which has displayio support.

“”“

import time

import board

import displayio

import adafruit_il0373

import terminalio

from adafruit_display_text import label

BLACK = 0x000000

WHITE = 0xFFFFFF

RED = 0xFF0000

# Change text colors, choose from the following values:

# BLACK, RED, WHITE

FOREGROUND_COLOR = RED

BACKGROUND_COLOR = WHITE

# Used to ensure the display is free in CircuitPython

displayio.release_displays()

# Define the pins needed for display use

# This pinout is for a Feather M4 and may be different for other boards

spi = board.SPI() # Uses SCK and MOSI

epd_cs = board.D9

epd_dc = board.D10

epd_reset = board.D5

epd_busy = board.D6

# Create the displayio connection to the display pins

display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs,

reset=epd_reset, baudrate=1000000)

time.sleep(1) # Wait a bit

# Create the display object - the third color is red (0xff0000)

DISPLAY_WIDTH = 212

DISPLAY_HEIGHT = 104

display = adafruit_il0373.IL0373(display_bus, width=DISPLAY_WIDTH,

height=DISPLAY_HEIGHT,

rotation=90, busy_pin=epd_busy,

highlight_color=0xff0000)

# Create a display group for our screen objects

g = displayio.Group(max_size=10)

# Set a background

background_bitmap = displayio.Bitmap(DISPLAY_WIDTH, DISPLAY_HEIGHT, 1)

# Map colors in a palette

palette = displayio.Palette(1)

palette[0] = BACKGROUND_COLOR

# Create a Tilegrid with the background and put in the displayio group

t = displayio.TileGrid(background_bitmap, pixel_shader=palette)

g.append(t)

# Draw simple text using the built-in font into a displayio group

text_group = displayio.Group(max_size=10, scale=2, x=20, y=40)

text = ”Hello World!“

text_area = label.Label(terminalio.FONT, text=text, color=FOREGROUND_COLOR)

text_group.append(text_area) # Add this text to the text group

g.append(text_group)

# Place the display group on the screen

display.show(g)

# Refresh the display to have everything show on the display

# NOTE: Do not refresh eInk displays more often than 180 seconds!

display.refresh()

time.sleep(120)

while True:

pass

”“”

Simple text script for Adafruit 2.13“ 212x104 tri-color display

Supported products:

* Adafruit 2.13” Tri-Color Display Breakout

* Adafruit 2.13“ Tri-Color Display FeatherWing

https://www.adafruit.com/product/4086 (breakout) or

https://www.adafruit.com/product/4128 (FeatherWing)

This program requires the adafruit_il0373 library and the

adafruit_display_text library in the CIRCUITPY /lib folder

for CircuitPython 5.0 and above which has displayio support.

”“”

import time

import board

import displayio

import adafruit_il0373

import terminalio

from adafruit_display_text import label

BLACK = 0x000000

WHITE = 0xFFFFFF

RED = 0xFF0000

# Change text colors, choose from the following values:

# BLACK, RED, WHITE

FOREGROUND_COLOR = RED

BACKGROUND_COLOR = WHITE

# Used to ensure the display is free in CircuitPython

displayio.release_displays()

# Define the pins needed for display use

# This pinout is for a Feather M4 and may be different for other boards

spi = board.SPI() # Uses SCK and MOSI

epd_cs = board.D9

epd_dc = board.D10

epd_reset = board.D5

epd_busy = board.D6

# Create the displayio connection to the display pins

display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs,

reset=epd_reset, baudrate=1000000)

time.sleep(1) # Wait a bit

# Create the display object - the third color is red (0xff0000)

DISPLAY_WIDTH = 212

DISPLAY_HEIGHT = 104

display = adafruit_il0373.IL0373(display_bus, width=DISPLAY_WIDTH,

height=DISPLAY_HEIGHT,

rotation=90, busy_pin=epd_busy,

highlight_color=0xff0000)

# Create a display group for our screen objects

g = displayio.Group(max_size=10)

# Set a background

background_bitmap = displayio.Bitmap(DISPLAY_WIDTH, DISPLAY_HEIGHT, 1)

# Map colors in a palette

palette = displayio.Palette(1)

palette[0] = BACKGROUND_COLOR

# Create a Tilegrid with the background and put in the displayio group

t = displayio.TileGrid(background_bitmap, pixel_shader=palette)

g.append(t)

# Draw simple text using the built-in font into a displayio group

text_group = displayio.Group(max_size=10, scale=2, x=20, y=40)

text = “Hello World!”

text_area = label.Label(terminalio.FONT, text=text, color=FOREGROUND_COLOR)

text_group.append(text_area) # Add this text to the text group

g.append(text_group)

# Place the display group on the screen

display.show(g)

# Refresh the display to have everything show on the display

# NOTE: Do not refresh eInk displays more often than 180 seconds!

display.refresh()

time.sleep(120)

while True:

pass

2.7“ eInk Shield示例

這些引腳反映了屏蔽eInk顯示屏和Metro M4的組合。它還具有2.7英寸顯示屏的像素尺寸。

下載:Project Zip 或 27_tricolor_eink_shiel d_text.py | 在Github上查看

復(fù)制代碼

“”“

Simple text script for 2.7” 264x176 Tri-Color display shield

Supported products:

* Adafruit 2.7“ Tri-Color ePaper Display Shield

https://www.adafruit.com/product/4229

This program requires the adafruit_il91874 and the

adafruit_display_text library in /lib on the CIRCUITPY drive

for CircuitPython 5.0 and above which has displayio support.

”“”

import time

import board

import displayio

import adafruit_il91874

import terminalio

from adafruit_display_text import label

BLACK = 0x000000

WHITE = 0xFFFFFF

RED = 0xFF0000

# Change text colors, choose from the following values:

# BLACK, WHITE, RED (note red on this display is not vivid)

FOREGROUND_COLOR = BLACK

BACKGROUND_COLOR = WHITE

# Used to ensure the display is free in CircuitPython

displayio.release_displays()

# Define the pins needed for display use on the Metro

spi = board.SPI()

epd_cs = board.D10

epd_dc = board.D9

# Create the displayio connection to the display pins

display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs,

baudrate=1000000)

time.sleep(1) # Wait a bit

# Create the display object - the third color is red (0xff0000)

DISPLAY_WIDTH = 264

DISPLAY_HEIGHT = 176

# Create the display object - the third color is red (0xff0000)

display = adafruit_il91874.IL91874(display_bus, width=DISPLAY_WIDTH,

height=DISPLAY_HEIGHT,

highlight_color=0xff0000, rotation=90)

# Create a display group for our screen objects

g = displayio.Group(max_size=10)

# Set a white background

background_bitmap = displayio.Bitmap(DISPLAY_WIDTH, DISPLAY_HEIGHT, 1)

# Map colors in a palette

palette = displayio.Palette(1)

palette[0] = BACKGROUND_COLOR

# Create a Tilegrid with the background and put in the displayio group

t = displayio.TileGrid(background_bitmap, pixel_shader=palette)

g.append(t)

# Draw simple text using the built-in font into a displayio group

text_group = displayio.Group(max_size=10, scale=2, x=40, y=40)

text = “Hello World!”

text_area = label.Label(terminalio.FONT, text=text, color=FOREGROUND_COLOR)

text_group.append(text_area) # Add this text to the text group

g.append(text_group)

# Place the display group on the screen

display.show(g)

# Refresh the display to have everything show on the display

# NOTE: Do not refresh eInk displays more often than 180 seconds!

display.refresh()

time.sleep(180)

while True:

pass

“”“

Simple text script for 2.7” 264x176 Tri-Color display shield

Supported products:

* Adafruit 2.7“ Tri-Color ePaper Display Shield

https://www.adafruit.com/product/4229

This program requires the adafruit_il91874 and the

adafruit_display_text library in /lib on the CIRCUITPY drive

for CircuitPython 5.0 and above which has displayio support.

”“”

import time

import board

import displayio

import adafruit_il91874

import terminalio

from adafruit_display_text import label

BLACK = 0x000000

WHITE = 0xFFFFFF

RED = 0xFF0000

# Change text colors, choose from the following values:

# BLACK, WHITE, RED (note red on this display is not vivid)

FOREGROUND_COLOR = BLACK

BACKGROUND_COLOR = WHITE

# Used to ensure the display is free in CircuitPython

displayio.release_displays()

# Define the pins needed for display use on the Metro

spi = board.SPI()

epd_cs = board.D10

epd_dc = board.D9

# Create the displayio connection to the display pins

display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs,

baudrate=1000000)

time.sleep(1) # Wait a bit

# Create the display object - the third color is red (0xff0000)

DISPLAY_WIDTH = 264

DISPLAY_HEIGHT = 176

# Create the display object - the third color is red (0xff0000)

display = adafruit_il91874.IL91874(display_bus, width=DISPLAY_WIDTH,

height=DISPLAY_HEIGHT,

highlight_color=0xff0000, rotation=90)

# Create a display group for our screen objects

g = displayio.Group(max_size=10)

# Set a white background

background_bitmap = displayio.Bitmap(DISPLAY_WIDTH, DISPLAY_HEIGHT, 1)

# Map colors in a palette

palette = displayio.Palette(1)

palette[0] = BACKGROUND_COLOR

# Create a Tilegrid with the background and put in the displayio group

t = displayio.TileGrid(background_bitmap, pixel_shader=palette)

g.append(t)

# Draw simple text using the built-in font into a displayio group

text_group = displayio.Group(max_size=10, scale=2, x=40, y=40)

text = “Hello World!”

text_area = label.Label(terminalio.FONT, text=text, color=FOREGROUND_COLOR)

text_group.append(text_area) # Add this text to the text group

g.append(text_group)

# Place the display group on the screen

display.show(g)

# Refresh the display to have everything show on the display

# NOTE: Do not refresh eInk displays more often than 180 seconds!

display.refresh()

time.sleep(180)

while True:

pass

代碼查看

對(duì)于概述將displayio用于CircuitPython的顯示,這是出色的指南,使用displayio的CircuitPython顯示支持是您的第一站。如果您想更深入地了解用于顯示器的模型,請(qǐng)參閱本指南。

Adafruit建議在嘗試執(zhí)行其他代碼以確保顯示器連接到顯示器之前,使用 displayio.release_displays()函數(shù)。

下一步是讓displayio知道顯示器上使用了哪些引腳。所使用的特定引腳在很大程度上取決于顯示器,建議您在尋求更改之前,先參考顯示器上的指南以了解已知的工作配置。 displayio.FourWire設(shè)置與顯示總線(xiàn)的displayio連接。

使用總線(xiàn),程序建立與顯示驅(qū)動(dòng)器。給出了顯示的大小(adafruit_il0373和width),方向(height),忙碌引腳和突出顯示顏色。對(duì)于此三色顯示,指定了紅色(rotation)。

其余代碼遵循標(biāo)準(zhǔn)的0xff0000顯示設(shè)置和使用:

創(chuàng)建顯示組

將所需的背景色設(shè)置為位圖

創(chuàng)建TileGrid以將對(duì)象與位圖一起放入并將圖塊組附加到顯示組中

為文本添加顯示組項(xiàng)目并使用“ Hello World!”作為示例文本。文本將按比例縮放兩個(gè)大小,并位于displayio,x=40處,以將其從左上方向下移動(dòng)到右側(cè)。

在屏幕上顯示顯示內(nèi)容

刷新屏幕

最后,程序等待3分鐘(最小刷新時(shí)間。然后,程序使用y=40和while True:語(yǔ)句來(lái)保持當(dāng)前狀態(tài)直到處理器復(fù)位為止。

示例:姓名徽章

最后一個(gè)示例在eInk顯示器上的位圖上顯示文本,從而使名稱(chēng)徽章對(duì)于聚會(huì)或會(huì)議非常有用。

圖像

此示例使用BMP格式的方形圖片文件顯示在顯示屏的左側(cè)。可能是某人的圖片,徽標(biāo)或其他藝術(shù)品。

要使用高度為104像素的2.13“顯示器,請(qǐng)將圖像設(shè)為104x104。

要使用2.7”顯示屏的高度為176像素,使圖像的尺寸為176x176。

由于eInk顯示屏只能使用3種顏色,因此請(qǐng)參閱隨附的指南“為E-Ink顯示屏準(zhǔn)備圖形”。查看它們可能如何在您選擇的顯示器上最佳顯示。

以下是示例中使用的示例圖片。對(duì)于2.13英寸顯示屏,請(qǐng)使用較小的圖片;對(duì)于2.7英寸屏蔽板,請(qǐng)使用較大的圖片。將圖像作為 picture.bmp 復(fù)制到開(kāi)發(fā)板的 CIRCUITPY 驅(qū)動(dòng)器。

代碼

下面的代碼將在左側(cè)顯示一個(gè)正方形圖片,使用internal terminalio字體在eInk顯示屏的右側(cè)放置兩行文本。您可以設(shè)置前景色和背景色。請(qǐng)參閱注釋以了解每個(gè)步驟如何對(duì)過(guò)程作出貢獻(xiàn)。

請(qǐng)選擇特定于顯示器和微控制器的代碼,因?yàn)橐韵聝蓚€(gè)代碼塊對(duì)于兩組硬件均不可互換。這些示例幾乎是相同的。

“ 2.13”顯示效果更真實(shí)紅色,而2.7英寸顯示屏則使用更多的粉紅色。這完全取決于顯示器的制造方式,而不取決于顯示器本身的顏色問(wèn)題。請(qǐng)將此因素納入您的顏色選擇計(jì)劃中。

2.13“ eInk FeatherWing示例

引腳反映了FeatherWing eInk顯示器和Feather M4的組合。它還具有2.13英寸顯示器的像素尺寸。

下載:Project Zip 或 213_tricolor_eink_fw_badge.py | 在Github上查看

復(fù)制代碼

“”“

Simple badge script for Adafruit 2.13” 212x104 tri-color display

Supported products:

* Adafruit 2.13“ Tri-Color Display Breakout

* https://www.adafruit.com/product/4086 (breakout) or

* https://www.adafruit.com/product/4128 (FeatherWing)

This program requires the adafruit_il0373 library and the

adafruit_display_text library in the CIRCUITPY /lib folder

for CircuitPython 5.0 and above which has displayio support.

”“”

import time

import board

import displayio

import adafruit_il0373

import terminalio

from adafruit_display_text import label

BLACK = 0x000000

WHITE = 0xFFFFFF

RED = 0xFF0000

# Change text colors, choose from the following values:

# BLACK, RED, WHITE

TEXT_COLOR = BLACK

BACKGROUND_COLOR = WHITE

# Used to ensure the display is free in CircuitPython

displayio.release_displays()

# Define the pins needed for display use

# This pinout is for a Feather M4 and may be different for other boards

spi = board.SPI() # Uses SCK and MOSI

epd_cs = board.D9

epd_dc = board.D10

epd_reset = board.D5

epd_busy = board.D6

# Create the displayio connection to the display pins

display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs,

reset=epd_reset, baudrate=1000000)

time.sleep(1) # Wait a bit

DISPLAY_WIDTH = 212

DISPLAY_HEIGHT = 104

# Create the display object - the third color is red (0xff0000)

display = adafruit_il0373.IL0373(display_bus, width=DISPLAY_WIDTH,

height=DISPLAY_HEIGHT,

rotation=90, busy_pin=epd_busy,

highlight_color=0xff0000)

# Create a display group for our screen objects

g = displayio.Group()

# Set a background

background_bitmap = displayio.Bitmap(DISPLAY_WIDTH, DISPLAY_HEIGHT, 1)

# Map colors in a palette

palette = displayio.Palette(1)

palette[0] = BACKGROUND_COLOR

# Put the background into the display group

bg_sprite = displayio.TileGrid(background_bitmap,

pixel_shader=palette,

x=0, y=0)

g.append(bg_sprite)

# Display a picture from the root directory of the CIRCUITPY drive

# Picture should be HEIGHTxHEIGHT square idealy for a portrait

# But could be the entire WIDTHxHEIGHT for a non-portrait

f = open(“/picture.bmp”, “rb”)

pic = displayio.OnDiskBitmap(f)

# Create a Tilegrid with the bitmap and put in the displayio group

t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())

g.append(t)

# Draw simple text using the built-in font into a displayio group

# For smaller text, change scale=2 to scale=1

text_group = displayio.Group(max_size=10, scale=2,

x=DISPLAY_HEIGHT + 10,

y=int(DISPLAY_HEIGHT/2) - 13)

first_name = “Limor”

text_area = label.Label(terminalio.FONT, text=first_name,

color=TEXT_COLOR)

text_group.append(text_area) # Add this text to the text group

g.append(text_group)

# Draw simple text using the built-in font into a displayio group

text_group = displayio.Group(max_size=10, scale=2,

x=DISPLAY_HEIGHT + 10,

y=int(DISPLAY_HEIGHT/2) + 13)

last_name = “Ladyada”

text_area = label.Label(terminalio.FONT, text=last_name,

color=TEXT_COLOR)

text_group.append(text_area) # Add this text to the text group

g.append(text_group)

# Place the display group on the screen

display.show(g)

# Refresh the display to have it actually show

# NOTE: Do not refresh eInk displays more often than 180 seconds!

display.refresh()

# Wait the minimum 3 minutes between refreshes. Then loop to freeze.

time.sleep(180)

while True:

pass

“”“

Simple badge script for Adafruit 2.13” 212x104 tri-color display

Supported products:

* Adafruit 2.13“ Tri-Color Display Breakout

* https://www.adafruit.com/product/4086 (breakout) or

* https://www.adafruit.com/product/4128 (FeatherWing)

This program requires the adafruit_il0373 library and the

adafruit_display_text library in the CIRCUITPY /lib folder

for CircuitPython 5.0 and above which has displayio support.

”“”

import time

import board

import displayio

import adafruit_il0373

import terminalio

from adafruit_display_text import label

BLACK = 0x000000

WHITE = 0xFFFFFF

RED = 0xFF0000

# Change text colors, choose from the following values:

# BLACK, RED, WHITE

TEXT_COLOR = BLACK

BACKGROUND_COLOR = WHITE

# Used to ensure the display is free in CircuitPython

displayio.release_displays()

# Define the pins needed for display use

# This pinout is for a Feather M4 and may be different for other boards

spi = board.SPI() # Uses SCK and MOSI

epd_cs = board.D9

epd_dc = board.D10

epd_reset = board.D5

epd_busy = board.D6

# Create the displayio connection to the display pins

display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs,

reset=epd_reset, baudrate=1000000)

time.sleep(1) # Wait a bit

DISPLAY_WIDTH = 212

DISPLAY_HEIGHT = 104

# Create the display object - the third color is red (0xff0000)

display = adafruit_il0373.IL0373(display_bus, width=DISPLAY_WIDTH,

height=DISPLAY_HEIGHT,

rotation=90, busy_pin=epd_busy,

highlight_color=0xff0000)

# Create a display group for our screen objects

g = displayio.Group()

# Set a background

background_bitmap = displayio.Bitmap(DISPLAY_WIDTH, DISPLAY_HEIGHT, 1)

# Map colors in a palette

palette = displayio.Palette(1)

palette[0] = BACKGROUND_COLOR

# Put the background into the display group

bg_sprite = displayio.TileGrid(background_bitmap,

pixel_shader=palette,

x=0, y=0)

g.append(bg_sprite)

# Display a picture from the root directory of the CIRCUITPY drive

# Picture should be HEIGHTxHEIGHT square idealy for a portrait

# But could be the entire WIDTHxHEIGHT for a non-portrait

f = open(“/picture.bmp”, “rb”)

pic = displayio.OnDiskBitmap(f)

# Create a Tilegrid with the bitmap and put in the displayio group

t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())

g.append(t)

# Draw simple text using the built-in font into a displayio group

# For smaller text, change scale=2 to scale=1

text_group = displayio.Group(max_size=10, scale=2,

x=DISPLAY_HEIGHT + 10,

y=int(DISPLAY_HEIGHT/2) - 13)

first_name = “Limor”

text_area = label.Label(terminalio.FONT, text=first_name,

color=TEXT_COLOR)

text_group.append(text_area) # Add this text to the text group

g.append(text_group)

# Draw simple text using the built-in font into a displayio group

text_group = displayio.Group(max_size=10, scale=2,

x=DISPLAY_HEIGHT + 10,

y=int(DISPLAY_HEIGHT/2) + 13)

last_name = “Ladyada”

text_area = label.Label(terminalio.FONT, text=last_name,

color=TEXT_COLOR)

text_group.append(text_area) # Add this text to the text group

g.append(text_group)

# Place the display group on the screen

display.show(g)

# Refresh the display to have it actually show

# NOTE: Do not refresh eInk displays more often than 180 seconds!

display.refresh()

# Wait the minimum 3 minutes between refreshes. Then loop to freeze.

time.sleep(180)

while True:

pass

div》 2.7“ eInk Shield示例

引腳反映了屏蔽eInk顯示屏和Metro M4的組合。它具有2.7”顯示屏的像素尺寸。

下載:Project Zip 或 27 _tricolor_eink_shield_badge.py | 在Github上查看

復(fù)制代碼

“”“

Simple Badge script for a 2.7” 264x176 Tri-Color eInk display shield

Supported products:

* Adafruit 2.7“ Tri-Color ePaper Display Shield

https://www.adafruit.com/product/4229

This program requires the adafruit_il91874 and the

adafruit_display_text library in /lib on the CIRCUITPY drive

for CircuitPython 5.0 and above which has displayio support.

”“”

import time

import board

import displayio

import adafruit_il91874

import terminalio

from adafruit_display_text import label

BLACK = 0x000000

WHITE = 0xFFFFFF

RED = 0xFF0000

# Change text colors, choose from the following values:

# BLACK, RED, WHITE

TEXT_COLOR = BLACK

BACKGROUND_COLOR = WHITE

# Used to ensure the display is free in CircuitPython

displayio.release_displays()

# Define the pins needed for display use on the Metro

spi = board.SPI()

epd_cs = board.D10

epd_dc = board.D9

# Create the displayio connection to the display pins

display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs,

baudrate=1000000)

time.sleep(1) # Wait a bit

DISPLAY_WIDTH = 264

DISPLAY_HEIGHT = 176

# Create the display object - the third color is red (0xff0000)

display = adafruit_il91874.IL91874(display_bus, width=DISPLAY_WIDTH,

height=DISPLAY_HEIGHT,

highlight_color=0xff0000, rotation=90)

# Create a display group for our screen objects

g = displayio.Group(max_size=10)

# Set a background

background_bitmap = displayio.Bitmap(DISPLAY_WIDTH, DISPLAY_HEIGHT, 1)

# Map colors in a palette

palette = displayio.Palette(1)

palette[0] = BACKGROUND_COLOR

# Put the background into the display group

bg_sprite = displayio.TileGrid(background_bitmap,

pixel_shader=palette,

x=0, y=0)

g.append(bg_sprite)

# Display a picture from the root directory of the CIRCUITPY drive

# Picture should be HEIGHTxHEIGHT square idealy for a portrait

# But could be the entire WIDTHxHEIGHT for a non-portrait

f = open(“/picture.bmp”, “rb”)

pic = displayio.OnDiskBitmap(f)

# Create a Tilegrid with the bitmap and put in the displayio group

t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())

g.append(t)

# Draw simple text using the built-in font into a displayio group

# For smaller text, change scale=2 to scale=1 as scale 2 doesn‘t

# allow for much text but the text is bigger.

text_group = displayio.Group(max_size=10, scale=2,

x=DISPLAY_HEIGHT + 5,

y=int(DISPLAY_HEIGHT/2) - 13)

first_name = “Limor”

text_area = label.Label(terminalio.FONT, text=first_name,

color=TEXT_COLOR)

text_group.append(text_area) # Add this text to the text group

g.append(text_group)

# Draw simple text using the built-in font into a displayio group

# For smaller text, change scale=2 to scale=1 as scale 2 doesn’t

# allow for much text but the text is bigger.

text_group = displayio.Group(max_size=10, scale=2,

x=DISPLAY_HEIGHT + 5,

y=int(DISPLAY_HEIGHT/2) + 13)

last_name = “Fried”

text_area = label.Label(terminalio.FONT, text=last_name,

color=TEXT_COLOR)

text_group.append(text_area) # Add this text to the text group

g.append(text_group)

# Place the display group on the screen

display.show(g)

# Refresh the display to have it actually show

# NOTE: Do not refresh eInk displays more often than 180 seconds!

display.refresh()

# Wait the minimum 3 minutes between refreshes. Then loop to freeze.

time.sleep(180)

while True:

pass

“”“

Simple Badge script for a 2.7” 264x176 Tri-Color eInk display shield

Supported products:

* Adafruit 2.7“ Tri-Color ePaper Display Shield

https://www.adafruit.com/product/4229

This program requires the adafruit_il91874 and the

adafruit_display_text library in /lib on the CIRCUITPY drive

for CircuitPython 5.0 and above which has displayio support.

”“”

import time

import board

import displayio

import adafruit_il91874

import terminalio

from adafruit_display_text import label

BLACK = 0x000000

WHITE = 0xFFFFFF

RED = 0xFF0000

# Change text colors, choose from the following values:

# BLACK, RED, WHITE

TEXT_COLOR = BLACK

BACKGROUND_COLOR = WHITE

# Used to ensure the display is free in CircuitPython

displayio.release_displays()

# Define the pins needed for display use on the Metro

spi = board.SPI()

epd_cs = board.D10

epd_dc = board.D9

# Create the displayio connection to the display pins

display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs,

baudrate=1000000)

time.sleep(1) # Wait a bit

DISPLAY_WIDTH = 264

DISPLAY_HEIGHT = 176

# Create the display object - the third color is red (0xff0000)

display = adafruit_il91874.IL91874(display_bus, width=DISPLAY_WIDTH,

height=DISPLAY_HEIGHT,

highlight_color=0xff0000, rotation=90)

# Create a display group for our screen objects

g = displayio.Group(max_size=10)

# Set a background

background_bitmap = displayio.Bitmap(DISPLAY_WIDTH, DISPLAY_HEIGHT, 1)

# Map colors in a palette

palette = displayio.Palette(1)

palette[0] = BACKGROUND_COLOR

# Put the background into the display group

bg_sprite = displayio.TileGrid(background_bitmap,

pixel_shader=palette,

x=0, y=0)

g.append(bg_sprite)

# Display a picture from the root directory of the CIRCUITPY drive

# Picture should be HEIGHTxHEIGHT square idealy for a portrait

# But could be the entire WIDTHxHEIGHT for a non-portrait

f = open(“/picture.bmp”, “rb”)

pic = displayio.OnDiskBitmap(f)

# Create a Tilegrid with the bitmap and put in the displayio group

t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())

g.append(t)

# Draw simple text using the built-in font into a displayio group

# For smaller text, change scale=2 to scale=1 as scale 2 doesn‘t

# allow for much text but the text is bigger.

text_group = displayio.Group(max_size=10, scale=2,

x=DISPLAY_HEIGHT + 5,

y=int(DISPLAY_HEIGHT/2) - 13)

first_name = “Limor”

text_area = label.Label(terminalio.FONT, text=first_name,

color=TEXT_COLOR)

text_group.append(text_area) # Add this text to the text group

g.append(text_group)

# Draw simple text using the built-in font into a displayio group

# For smaller text, change scale=2 to scale=1 as scale 2 doesn’t

# allow for much text but the text is bigger.

text_group = displayio.Group(max_size=10, scale=2,

x=DISPLAY_HEIGHT + 5,

y=int(DISPLAY_HEIGHT/2) + 13)

last_name = “Fried”

text_area = label.Label(terminalio.FONT, text=last_name,

color=TEXT_COLOR)

text_group.append(text_area) # Add this text to the text group

g.append(text_group)

# Place the display group on the screen

display.show(g)

# Refresh the display to have it actually show

# NOTE: Do not refresh eInk displays more often than 180 seconds!

display.refresh()

# Wait the minimum 3 minutes between refreshes. Then loop to freeze.

time.sleep(180)

while True:

pass

代碼查看

對(duì)于概述將displayio用于CircuitPython的顯示,這是出色的指南,使用displayio的CircuitPython顯示支持是您的第一站。如果您想更深入地了解用于顯示器的模型,請(qǐng)參閱本指南。

Adafruit建議在嘗試執(zhí)行其他代碼以確保顯示器連接到顯示器之前,使用 displayio.release_displays()函數(shù)。

下一步是讓displayio知道顯示器上使用了哪些引腳。所使用的特定引腳在很大程度上取決于顯示器,建議您在尋求更改之前,先參考顯示器上的指南以了解已知的工作配置。 displayio.FourWire設(shè)置與顯示總線(xiàn)的displayio連接。

定義了顯示尺寸(特定于顯示器)。然后在總線(xiàn)上,程序建立與顯示驅(qū)動(dòng)程序的連接。給出了顯示的大小(width和height),方向(rotation),忙碌引腳和突出顯示顏色。對(duì)于此三色顯示,指定了紅色(0xff0000)。

其余代碼與后兩個(gè)示例非常相似。首先,從 CIRCUITPY 驅(qū)動(dòng)器的根目錄中讀取一個(gè)名為 picture.bmp 的位圖圖形。通過(guò)displayio.TileGrid在顯示組中設(shè)置圖形。然后定義兩行文本。它們被放置在位圖的右邊幾個(gè)像素處,并與顯示高度的中間等距。

此莊園中容納的文字很少。您可以通過(guò)兩種方法來(lái)獲得更大的文本寬度:

將scale=2更改為scale=1將使每行字符更多,但文本將更小。

如果需要最終的靈活性,建議您將所有設(shè)計(jì)元素創(chuàng)建到一個(gè)位圖圖片中,并使用第一個(gè)示例僅顯示位圖。

該程序?qū)⑺薪M放置屏幕上具有display.show的元素將刷新display.refresh的顯示,以實(shí)際顯示圖形。 eInk顯示器需要2-3秒鐘才能刪除上一張圖像并顯示新圖像。

最后,程序?qū)⒌却?分鐘。 while True:和pass 循環(huán)位于程序的末尾,因此REPL不會(huì)擦除標(biāo)志圖像。按下重置按鈕將再次啟動(dòng)程序。

深入

本指南是對(duì)在使用CircuitPython和displayio庫(kù)的三色eInk顯示器上使用位圖圖形和文本的介紹。

其他《 Adafruit學(xué)習(xí)系統(tǒng)指南》提供了制作不同屏幕元素的更多示例。有關(guān)更多信息,請(qǐng)參考以下指南:

Adafruit eInk顯示器突破點(diǎn)

為電子墨水顯示器準(zhǔn)備圖形 p》

使用displayio

支持CircuitPython顯示對(duì)于更多高級(jí)名稱(chēng)標(biāo)簽,您可以考慮將Adafruit PyBadge與TFT LCD顯示器一起使用

帶有Unicode字體的PyBadge會(huì)議徽章
責(zé)任編輯:wv

聲明:本文內(nèi)容及配圖由入駐作者撰寫(xiě)或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點(diǎn)僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場(chǎng)。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問(wèn)題,請(qǐng)聯(lián)系本站處理。 舉報(bào)投訴
  • 顯示屏
    +關(guān)注

    關(guān)注

    30

    文章

    4703

    瀏覽量

    79699
收藏 人收藏
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

    評(píng)論

    相關(guān)推薦
    熱點(diǎn)推薦

    eink墨水高效開(kāi)發(fā)秘籍:開(kāi)源庫(kù)與演示系統(tǒng)全揭秘

    想要在最短時(shí)間內(nèi)完成eink墨水項(xiàng)目的原型驗(yàn)證?關(guān)鍵在于選擇合適的開(kāi)發(fā)工具。高性能開(kāi)源eink庫(kù),集成多種刷新算法優(yōu)化,并提供配套演示系統(tǒng),覆蓋文字、圖像、動(dòng)畫(huà)等展示場(chǎng)景,助你輕松實(shí)現(xiàn)高效開(kāi)發(fā)
    的頭像 發(fā)表于 02-25 20:00 ?311次閱讀
    <b class='flag-5'>eink</b>墨水<b class='flag-5'>屏</b>高效開(kāi)發(fā)秘籍:開(kāi)源庫(kù)與演示系統(tǒng)全揭秘

    開(kāi)源!eink墨水庫(kù)+演示系統(tǒng),高效開(kāi)發(fā)必看

    硬件驅(qū)動(dòng)到界面設(shè)計(jì)的完整解決方案,助你快速構(gòu)建穩(wěn)定、低功耗的墨水應(yīng)用。 一、 eink墨水操作庫(kù) LuatOS eink庫(kù)是專(zhuān)為電子墨水
    的頭像 發(fā)表于 02-23 21:53 ?534次閱讀
    開(kāi)源!<b class='flag-5'>eink</b>墨水<b class='flag-5'>屏</b>庫(kù)+演示系統(tǒng),高效開(kāi)發(fā)必看

    LED顯示屏常見(jiàn)故障分類(lèi)及處理方法

    常見(jiàn)故障分類(lèi)LED顯示屏常見(jiàn)故障分為三類(lèi):LED模組常見(jiàn)故障、室內(nèi)全彩顯示屏故障及戶(hù)外全彩顯示屏故障。針對(duì)每一類(lèi)故障,我們將詳細(xì)分析可能的原因,并提供具體的檢測(cè)與維修步驟。LED模組常見(jiàn)問(wèn)題及處理
    的頭像 發(fā)表于 12-18 15:48 ?1407次閱讀
    LED<b class='flag-5'>顯示屏</b>常見(jiàn)故障分類(lèi)及處理方法

    基于RK3568開(kāi)發(fā)板顯示屏調(diào)試適配方法(1)-如何在Uboot界面切換顯示屏

    顯示屏作為電子產(chǎn)品不可或缺的一部分,此文檔的目的在于幫助用戶(hù)調(diào)試適配其它顯示屏。本文檔將以調(diào)試適配7寸MIPI為例。本文檔章節(jié)安排:第一章:幫助用戶(hù)如何在Uboot界面切換顯示屏(L
    的頭像 發(fā)表于 11-07 16:19 ?554次閱讀
    基于RK3568開(kāi)發(fā)板<b class='flag-5'>顯示屏</b>調(diào)試適配方法(1)-如何在Uboot界面切換<b class='flag-5'>顯示屏</b>

    LED全息顯示屏:1920Hz與3840Hz刷新率對(duì)比解析

    在科技飛速發(fā)展的當(dāng)下,LED全息顯示屏以其獨(dú)特的視覺(jué)效果和廣泛的應(yīng)用場(chǎng)景,成為顯示領(lǐng)域的焦點(diǎn)。其中,刷新率作為衡量顯示屏性能的關(guān)鍵指標(biāo),直接影響著顯示效果、拍攝質(zhì)量以及應(yīng)用場(chǎng)景的選擇。
    的頭像 發(fā)表于 10-08 14:57 ?1605次閱讀
    LED全息<b class='flag-5'>顯示屏</b>:1920Hz與3840Hz刷新率對(duì)比解析

    碩博電子7寸觸摸顯示屏,支持CAN通信和Codesy編程#工業(yè)顯示屏 #汽車(chē)CAN總線(xiàn)? #觸摸顯示屏

    顯示屏
    長(zhǎng)沙碩博電子科技股份有限公司
    發(fā)布于 :2025年09月18日 15:29:59

    EMC整改顯示屏:怎么選擇?功率多少?

    南柯電子|EMC整改顯示屏:怎么選擇?功率多少?
    的頭像 發(fā)表于 08-28 09:30 ?1007次閱讀

    30千瓦的顯示屏EMC如何整改呢?

    南柯電子|30千瓦的顯示屏EMC如何整改呢?
    的頭像 發(fā)表于 07-24 09:35 ?724次閱讀

    液晶顯示屏出廠(chǎng)要做哪些安全檢測(cè)

    液晶顯示屏(LCD)在出廠(chǎng)時(shí)需要進(jìn)行一系列安全檢測(cè),以確保其在使用過(guò)程中不會(huì)對(duì)用戶(hù)造成任何潛在的安全隱患。這些檢測(cè)主要包括電氣安全、機(jī)械安全、環(huán)境適應(yīng)性等方面,以下是液晶顯示屏出廠(chǎng)需要做的主要安全
    的頭像 發(fā)表于 06-30 14:59 ?1473次閱讀
    液晶<b class='flag-5'>顯示屏</b>出廠(chǎng)要做哪些安全檢測(cè)

    戶(hù)外顯示屏驅(qū)動(dòng)板的具體防護(hù)措施

    驅(qū)動(dòng)板在戶(hù)外顯示屏中的防水設(shè)計(jì)是確保顯示屏長(zhǎng)期穩(wěn)定運(yùn)行的關(guān)鍵之一。
    的頭像 發(fā)表于 04-22 15:58 ?1166次閱讀

    LED顯示屏:點(diǎn)亮商業(yè)未來(lái)的璀璨之光

    LED顯示屏不僅是展示工具,更是連接品牌與消費(fèi)者的現(xiàn)代橋梁。在注意力經(jīng)濟(jì)時(shí)代,投資LED顯示屏就是投資于企業(yè)的可見(jiàn)度和影響力。讓我們攜手,用LED技術(shù)點(diǎn)亮您的商業(yè)未來(lái),在競(jìng)爭(zhēng)中贏得先機(jī)。
    的頭像 發(fā)表于 04-16 15:25 ?1561次閱讀
    LED<b class='flag-5'>顯示屏</b>:點(diǎn)亮商業(yè)未來(lái)的璀璨之光

    智慧路燈桿上 LED 顯示屏的信息發(fā)布

    LED 顯示屏究竟能發(fā)布哪些信息呢? 一、交通信息 實(shí)時(shí)路況 :LED 顯示屏可實(shí)時(shí)展示周邊道路的擁堵情況,通過(guò)不同顏色(如綠色表示暢通、黃色表示緩行、紅色表示擁堵)直觀呈現(xiàn)道路狀態(tài),幫助駕駛員提前規(guī)劃出行路線(xiàn),避開(kāi)擁堵路段,
    的頭像 發(fā)表于 04-12 21:59 ?1741次閱讀

    紅冉LED顯示屏:技術(shù)革新引領(lǐng)未來(lái)發(fā)展

    LED顯示屏作為一種高效、靈活的顯示技術(shù),近年來(lái)經(jīng)歷了翻天覆地的變革。從最初的單色顯示到全彩顯示,再到小間距和微LED技術(shù)的飛躍式發(fā)展,LED顯示屏
    的頭像 發(fā)表于 04-10 17:19 ?898次閱讀
    紅冉LED<b class='flag-5'>顯示屏</b>:技術(shù)革新引領(lǐng)未來(lái)發(fā)展