Cov txheej txheem:

Yuav Ua Li Cas Ntxiv E-Ink Zaub rau Koj Txoj Haujlwm: 12 Cov Kauj Ruam (nrog Duab)
Yuav Ua Li Cas Ntxiv E-Ink Zaub rau Koj Txoj Haujlwm: 12 Cov Kauj Ruam (nrog Duab)

Video: Yuav Ua Li Cas Ntxiv E-Ink Zaub rau Koj Txoj Haujlwm: 12 Cov Kauj Ruam (nrog Duab)

Video: Yuav Ua Li Cas Ntxiv E-Ink Zaub rau Koj Txoj Haujlwm: 12 Cov Kauj Ruam (nrog Duab)
Video: Mob nrob qaum/ Mob duav yog vim li cas? 2024, Kaum ib hlis
Anonim
Yuav Ua Li Cas Ntxiv E-Ink Zaub rau Koj Txoj Haujlwm
Yuav Ua Li Cas Ntxiv E-Ink Zaub rau Koj Txoj Haujlwm
Yuav Ua Li Cas Ntxiv E-Ink Zaub rau Koj Txoj Haujlwm
Yuav Ua Li Cas Ntxiv E-Ink Zaub rau Koj Txoj Haujlwm

Ntau txoj haujlwm koom nrog saib xyuas qee yam ntawm cov ntaub ntawv, xws li cov ntaub ntawv ib puag ncig, feem ntau siv Arduino rau kev tswj hwm. Hauv kuv qhov xwm txheej, kuv xav tshuaj xyuas qib ntsev hauv kuv cov dej muag muag. Koj yuav xav nkag mus saib cov ntaub ntawv hla koj lub network hauv tsev, tab sis sib npaug koj yuav xav qhia nws qhov twg nws raug ntsuas. Lossis koj tuaj yeem muaj qhov ib txwm nyob ntawm cov khoom sib txuas nyob deb ntawm qhov chaw yooj yim dua.

Tam sim no muaj ntau hom zaub uas koj tuaj yeem siv, txhua yam pheej yig heev, tab sis muaj qhov zoo sib txawv thiab qhov tsis zoo:

  • Cov lej lej lej LCD yog qhov pheej yig tshaj tab sis kuj yog qhov txwv.
  • OLED zaub tuaj yeem tso saib cov duab tab sis qhov pheej yig yog qhov me me. Daim duab thib ob qhia txog 128x64 pixel OLED zaub tom ntej ntawm E-Ink ib qho.
  • E-Ink (lossis E-Paper) zaub yog me ntsis loj dua thiab yog li nyeem tau yooj yim dua, thiab muaj qhov zoo dua uas cov zaub tau khaws cia txawm tias thaum nws raug kaw! Tab sis nws siv sijhawm ob peb feeb los rov ua dua cov zaub.

E-Ink zaub zoo li zoo rau kuv daim ntawv thov vim kuv tuaj yeem tsim kho Arduino kom sawv los tsuas yog ob peb teev, nyeem ntawv thiab tso saib ua ntej rov qab mus pw. Nws yog qhov tsis muaj txiaj ntsig uas nws yuav siv sijhawm ob peb feeb los rov ua dua cov zaub.

Hauv cov ntawv thov no, qhov nruab nrab kev siv tam sim no tuaj yeem npaj tau kom qis heev uas 9V lithium cov pa taws ntes cov roj teeb tuaj yeem ua rau kav ntev txog 10 xyoo! Dab tsi ntxiv, qee qhov kev qhia no yuav tso tawm peb xim: dawb, dub, thiab liab (lossis daj). Qhov zoo tshaj yog tias koj xav pom cov lus ceeb toom lossis ceeb toom liab.

Khoom siv

Qhov pheej yig tshaj plaws E-Ink cov lus kuv tau pom tau muag los ntawm BuyDisplay, tseem muaj los ntawm ntau tus muag khoom hauv eBay. Hmoov tsis zoo cov ntaub ntawv tawm ntau heev uas xav tau yog li kuv coj nws ntawm kuv tus kheej los sau ntawv qhia - nyeem rau!

Nyob ntawm koj cov kev xav tau thiab koj cov peev nyiaj, koj muaj kev xaiv ntawm ntau qhov ntau thiab tsawg:

  • 1.54 "(152x152 = 23, 104 pixels)
  • 2.13 "(212x104 = 22, 048 pixels)
  • 2.6 "(296x152 = 44, 992 pixels)
  • 2.7 "(176x264 = 46, 464 pixels)
  • 2.9 "(296x128 = 37, 888 pixels)
  • 4.2 "(400x300 = 120, 000 pixels)
  • 5.83 "(640x480 = 307, 200 pixels)
  • 7.5 "(880x528 = 464, 640 pixels)

(Qhov ntau tau nthuav tawm txij li lub sijhawm dhau los kuv saib yog li yuav nthuav dav ntxiv los ntawm lub sijhawm koj nyeem qhov no.)

Lawv muaj raws li 2-xim (dub/dawb) lossis 3 xim (dub/liab/dawb lossis dub/daj/dawb). Cov Lus Qhia no xav tias koj siv tus liab, tab sis yog tias koj tau xaiv cov xim daj, tsuas yog nyeem "daj" rau "liab" thoob plaws.

Xaiv qhov SPI (4-xaim) version. Kuv siv tus qauv 1.54 , uas yog qhov zoo nkauj heev.

Kauj Ruam 1: Txuas Koj Cov Zaub

Txuas Koj Cov Zaub
Txuas Koj Cov Zaub

Cov lus qhia no los nrog 2x4 tus pin header. Tus lej tus lej tau hais meej meej, tus lej 7, 5, 3 thiab 1 (ntawm sab laug mus rau sab xis) raws kab saum toj kawg nkaus thiab 8, 6, 4, 2 raws hauv qab.

Koj cov zaub yuav tuaj nrog 8-txoj kev thaj cable, uas ua rau kev sib txuas tau yooj yim. (Kuv daim kab xev muaj 2 lub xov tooj liab thiab 2 xim av. Lawv tsis hloov pauv tau!

Cov lus hauv qab no muab kev sib txuas, uas siv rau feem ntau ntawm Arduino (suav nrog Uno, Pro Mini, Pro Micro thiab Nano).

E-ink Module Arduino
Tus Pin Lub Npe Tus Pin Lub Npe
1 VDD Vcc 3.3/5V
2 VSS Gnd Gnd
3 Cov ntaub ntawv hauv 11 MOSI
4 Serial Moos Hauv 13 SCK
5 /Chip Xaiv 10
6 Cov ntaub ntawv/Instr 9
7 Pib dua 8
8 Tsis khoom 7

Kauj ruam 2: Rub tawm Cov Khoom Siv

Koj tuaj yeem siv cov software muab raws li tau piav qhia hauv theem no, lossis koj tuaj yeem siv kuv lub tsev qiv ntawv txhim kho hauv cov kauj ruam tom ntej tab sis ib qho.

Nrhiav koj lub cuab yeej ntawm BuyDisplay.com. Mus rau hauv qab ntawm nplooj ntawv koj yuav pom rub tawm ZIP cov ntaub ntawv "Arduino Library thiab Piv txwv rau 4-xaim SPI". Nyem rau qhov no rub tawm thiab qhib hauv Windows Explorer.

Windows Explorer yuav qhia qhov no raws li muaj ib daim ntawv teev npe saum toj kawg nkaus "Libraries-Examples_ER-EPM0154-1R". (Lub npe yuav txawv me ntsis yog tias koj li tsis yog tus qauv 1.54 ".)

Luam daim nplaub tshev saum toj no rau hauv koj phau ntawv teev npe Arduino. Txoj cai-nyem kom hloov lub npe, thiab rho tawm "Libraries-Examples_" los ntawm lub npe.

(Txhawm rau nrhiav koj cov ntawv khaws cia hauv Arduino, hauv Arduino IDE, nyem Cov Ntaub Ntawv … Nyiam, thiab nco ntsoov Sketchbook Qhov Chaw. Nkag mus rau qhov no, thiab koj yuav pom Arduino "cov tsev qiv ntawv" nplaub tshev ntawm koj cov duab kos.)

Qhib daim nplaub tshev no thiab qhib daim nplaub tshev "Tsev qiv ntawv" hauv nws. Luag thiab xa tag nrho cov ntaub ntawv hauv daim nplaub tshev no mus rau hauv daim nplaub tshev niam txiv ib qib nce ("ER-EPM0154-1R"). Rho tawm (tam sim no khoob) "Tsev qiv ntawv" nplaub tshev.

Tam sim no koj tau teeb tsa cov ntaub ntawv thiab kos duab kos ua lub tsev qiv ntawv Arduino. Nco ntsoov tias yog tias koj cov zaub tsis yog 1.54 ib qho, qhov sib txawv tsuas yog zoo li yog ob kab hauv ER-ERM*-1.h txhais WIDTH thiab HEIGHT.

Hauv Arduino IDE, nyem rau ntawm File … Exampes thiab nqes mus rau ER-EPM0154-1R rau daim duab qhia chaw, uas koj yuav tsum muaj peev xwm suav sau thiab khiav sai li sai tau thaum koj txuas nrog koj cov khoom rau koj Arduino.

Kauj ruam 3: Khiav Demo

Khiav lub Demo
Khiav lub Demo
Khiav lub Demo
Khiav lub Demo

Hauv Arduino IDE, nyem Cov Ntaub Ntawv … Piv txwv … ER-EPM0154-1R.

Txuas koj Arduino rau koj lub computer nrog USB cable, lossis txawm li cas los xij koj ib txwm ua.

Hauv Cov Cuab Yeej, teeb tsa Pawg Thawj Coj, Tus Txheej Txheem thiab Chaw Nres Nkoj.

Hauv qab Sketch, nyem Upload.

Yuav muaj qhov qeeb me ntsis tom qab upload tiav, thiab kaum qhov kev ncua yuav nyem ntau lub sijhawm raws li nws pleev xim thawj daim duab. Saib thaum nws mus dhau ntawm qhov demo.

Kauj Ruam 4: Siv Lub Tsev Qiv Ntawv Zoo Tshaj

Koj tuaj yeem rub kuv lub tsev qiv ntawv txhim kho los ntawm github ntawm

N. B. Kuv muaj qib siab ntawm kev ntseeg siab tias kuv lub tsev qiv ntawv yuav ua haujlwm nrog txhua qhov loj me me, tab sis kuv tsuas yog qhov tseeb sim nws nrog 1.54 qauv. Yog tias koj siv qhov sib txawv, thov qhia rau kuv paub hauv cov lus ntawm qhov kawg ntawm Cov Lus Qhia no, kom paub meej tias nws ua haujlwm.

Rub tawm thiab khaws cov ntawv zip. Hauv Arduino IDE, nyem Sketch… suav nrog Lub Tsev Qiv Ntawv… Ntxiv. ZIP Library thiab xaiv cov ntaub ntawv khaws tseg.

Kuv lub tsev qiv ntawv muaj ntau qhov kev txhim kho me me:

  • Nws tso cai siv tus lej tus lej Arduino sib txawv (tshwj tsis yog MOSI).
  • Tib lub tsev qiv ntawv tuaj yeem siv cov cuab yeej loj forany.
  • Ib qho tshiab 50% ntxoov ntxoo sau, thiab muaj qhov ua rau me me (teeb tsa lub teeb pixel) tau muab.

Lub tsev qiv ntawv los ua tus qauv Arduino compressed (zip) cov ntaub ntawv. Rub nws mus rau koj lub Downloads nplaub tshev (lossis qhov koj xav tau), thiab hauv Arduino IDE, nyem Sketch… suav nrog Lub Tsev Qiv Ntawv… Ntxiv ZIP Library.

Hauv Cov Piv Txwv, tam sim no koj yuav pom E-ink_ER-EPM. Muaj 3 qhov piv txwv piv txwv:

  • ER_EPM154-1R-Kuaj: Thawj tus neeg muag khoom muab ua qauv qhia
  • E-ink_demo: Cov duab kos tau tsim hauv cov kauj ruam tom ntej
  • E-ink_rotate: Ua piv txwv ntawm kev hloov duab.

Kauj ruam 5: Programming Nws Koj Tus Kheej

Hmoov tsis zoo tsis muaj cov ntaub ntawv nrog tus muag khoom muab tus lej, lossis tsis yog tus lej piv txwv tau hais qhia txaus. Qhov no ua rau nws nyuaj dua li nws yuav tsum tau siv, thiab lub hom phiaj tseem ceeb ntawm Cov Lus Qhia no yog txhawm rau ua qhov yog.

Cov Ntsiab Cai Yooj Yim

Txij li Arduino raug txwv nyob rau hauv qhov muaj ntawm RAM muaj, lub tsev qiv ntawv tso cai rau koj kos lossis sau rau hauv ntu me me ntawm lub vijtsam ib zaug, txhim kho lawv ib tus zuj zus mus rau lub cuab yeej nco ib ntus. Tsuas yog ib zaug koj tau tshaj tawm txhua ntu koj xav tau koj puas qhia nws kom pom qhov nws muaj hauv kev nco.

Cov ntu ntawm lub vijtsam no hu ua "Xim" cov khoom. Koj tsuas xav tau ib qho, thiab rau txhua ntu ntawm lub vijtsam koj txhais nws qhov siab, dav thiab kev sib hloov. Thaum ua tiav, koj upload nws, txheeb xyuas txoj haujlwm ntawm lub vijtsam kom thauj nws mus thiab seb nws yuav tsum yog xim dub thiab dawb lossis liab thiab dawb.

Sab laug sab tes laug ntawm lub vijtsam muaj kab rov tav (x) thiab ntsug (y) tswj hwm (0, 0), hauv qab sab laug yog (0, 151) thiab sab xis saum toj yog (151, 0).

Kev pib ua haujlwm

Qhib te E-ink_demo kos duab hauv Arduino IDE thiab ua raws nws raws li kuv piav qhia yuav siv lub tsev qiv ntawv li cas.

Nyob rau sab saud koj yuav pom cov kab hauv qab no, uas ib txwm xav tau:

#include <SPI.h #include "ER-ERM0154-1.h" #include "imagedata.h" #include "epdpaint.h" #define COLORED 0 #define UNCOLORED 1 Epd epd;

Cov kab #suav nrog rub tawm hauv cov tsev qiv ntawv xav tau. SPI.h yog lub tsev qiv ntawv Arduino tus qauv tab sis lwm qhov yog ib feem ntawm e-ink lub tsev qiv ntawv.

Peb txhais cov npe rau UNCOLORED (dawb) pixels thiab COLORED (dub lossis liab). (Nco tseg rau kuv cov phooj ywg nyob sab Europe: Asmeskas sau ntawv COLOR.)

Epd kev; kab tsim cov khoom siv hluav taws xob ntawv, uas peb yuav nthuav tawm. Qhov no yuav tsum nyob ntawm no thaum pib ntawm daim duab kos kom nws muaj rau bith teeb tsa () thiab voj () ua haujlwm.

Yog tias koj muaj qhov sib txawv me me zaub koj tuaj yeem hloov kab EPD los ntawm:

Epd epd (WIDTH, HEIGHT);

(yav tas los tau txhais WIDTH thiab HEIGHT hauv #txhais cov lus.)

Ib yam nkaus koj tuaj yeem hais qhia tus lej tus lej tsis yog-default nrog:

Epd epd (WIDTH, HEIGHT, BUSY_PIN, RESET_PIN, DC_PIN, CS_PIN);

Hauv kev teeb tsa () peb yuav tsum tau pib lub cuab yeej raws li hauv qab no:

Serial.begin (9600)

yog (epd. Init ()! = 0) {Serial.print ("e-Paper init ua tsis tau tejyam"); rov qab; }

(Qhov tseeb, epd. Init () yeej tsis rov ua qhov yuam kev, tab sis kev txhim kho yav tom ntej yuav kuaj pom qhov tsis tuaj ntawm cov zaub, lossis tsis ua haujlwm ib qho.)

Kauj Ruam 6: Sau Ntawv

Sau Ntawv
Sau Ntawv

Hauv E-ink_demo, tig koj lub ntsej muag rau lub voj (). Ua ntej, cia peb tshem cov zaub:

epd. ClearFrame ()

(Qhov no tsis yog qhov tsim nyog yog tias koj tab tom yuav tso koj tus kheej duab.)

Ua ntej peb tuaj yeem kos dab tsi (txawm yog ntawv lossis duab) peb yuav tsum tsim cov xim pleev xim los kos rau:

tsis kos npe duab [1024]

Xim xim (duab, 152, 18); // dav yuav tsum yog ntau ntawm 8

Qhov no khaws qee qhov chaw (1024 bytes) thiab faib nws mus rau Cov Khoom Xim, nyob ntawm kab thib ob. Qhov no tau teeb tsa raws li 152 pixels dav thiab 18 pixels tob. Peb tuaj yeem teeb tsa nws tom qab kom rov siv tau raws li qhov tsim nyog, tab sis nco ntsoov: qhov dav yuav tsum yog ntau ntawm 8 txij li 8 pixels tau khaws cia ib byte thiab peb tsis tuaj yeem faib cov bytes. (Nws yuav qhov tseeb hloov nws yog tias tsim nyog, tab sis nws tuaj yeem ua rau tsis meej pem thaum koj cov zaub tsis zoo li nws yuav tsum ua li cas.

Tam sim no peb yuav tsum tshem cov xim pleev xim rau UNCOLORED (dawb), tom qab ntawd ntawm txoj haujlwm (x, y) = (22, 2) peb sau "e-ink Demo" siv 16-pixel siab font, thiab COLORED (los qhia tawm tsam UNCOLORED keeb kwm yav dhau.

xim.lear (tsis hloov)

paint. DrawStringAt (12, 2, "e-paper Demo", & Font16, COLORED);

Nco ntsoov tias kev sib koom tes (22, 2) yog lub kaum sab laug sab tes laug ntawm thawj tus cim ntawm txoj hlua, thiab yog 22 pixels hauv thiab 2 pixels qis txheeb ze rau sab laug sab tes laug ntawm cov xim pleev xim, tsis yog tag nrho cov zaub. Cov ntawv zoo li tsawg kawg ib lub pixel nqis los rau saum cov khoom xim.

Cov fonts hauv qab no muaj:

Font8 - 5x8 pixelsFont12 - 7x12 pixelsFont16 - 11x16 pixelsFont20 - 14x20 pixelsFont24 - 17x24 pixels

Tam sim no peb tsuas yog yuav tsum xa cov khoom xim ("xim") mus rau lub cuab yeej ("epd"):

epd. SetPartialWindowBlack (xim. GetImage (), 0, 3, xim. GetWidth (), xim. GetHeight ());

SetPartialWindowBlack yog ib txoj hauv kev uas peb siv rau cov khoom epd, siv cov duab thiab nws qhov dav thiab qhov tob ntawm cov khoom xim. Peb tab tom qhia nws kom sau cov duab no rau lub cuab yeej ntawm (x, y) = (0, 3). Thiab peb tab tom hais tias COLORED pixels yuav tsum dub.

Qhov ntawd tsis nyuaj heev, puas yog? Cia peb sim ib qho ntxiv.

xim. Clear (COLORED);

paint. DrawStringAt (20, 2, "(Dawb ntawm xim)", & Font12, tsis hloov); epd. SetPartialWindowRed (xim. GetImage (), 0, 24, xim. GetWidth (), xim. GetHeight ());

Peb rov siv cov xim tib yam, thiab qhov dav thiab qhov siab tib yam, tab sis lub sijhawm no, cia peb tshem nws mus rau COLORED thiab sau ib txoj hlua tsis zoo rau nws. Thiab rau qhov kev hloov pauv, peb yuav ua rau COLORED pixels liab thiab sau nws mus rau lub cuab yeej ntawm (0, 24), tsuas yog qis dua thawj qhov.

Peb tau sau ob lub xim pleev xim rau lub cim xeeb ntawm lub cuab yeej tab sis tseem tsis tau qhia nws kom pom lawv. Peb ua qhov no nrog cov lus hauv qab no:

epd. DisplayFrame ();

(Hauv E-ink_demo kos duab peb tau tawm qhov no mus txog thaum kawg, tom qab kos qee yam ntxiv, tab sis koj tuaj yeem ntxig nws ntawm no yog tias koj nyiam, mybe ua raws li ncua (10000); muab sijhawm rau koj kom qhuas koj tes haujlwm.

Kauj Ruam 7: Teeb Kab thiab Duab Plaub

Teeb duab kab thiab duab plaub
Teeb duab kab thiab duab plaub

Cia peb pom yuav kos kab thiab duab plaub li cas. Peb yuav siv tib yam khoom xim, tab sis peb yuav tsum rov tsim dua nws li 40 pixels dav thiab 36 pixels siab. Peb yuav tshem nws mus rau UNCOLORED.

xim. SetWidth (40);

xim. SetHeight (36); xim. Clear (tsis hloov);

Peb tab tom yuav kos (COLORED) duab plaub nrog rau sab laug sab saum toj (5, 3) thiab hauv qab txoj cai (35, 33), txheeb ze rau cov khoom pleev xim, zoo li qub. Peb tseem yuav kos nws kab pheeb ces kaum raws kab los ntawm (5, 3) mus rau (35, 33) thiab los ntawm (35, 3) txog (5, 33). Thaum kawg, peb yuav sau tag nrho cov khoom xim (liab) rau lub vijtsam ntawm (32, 42).

// TOP ROW:

// Rectange paint. Clear (UNCOLORED); paint. DrawRectangle (5, 3, 35, 33, COLORED;) xim DrawLine (5, 3, 35, 33, COLORED); xim. DrawLine (35, 3, 5, 33, COLORED); epd. SetPartialWindowRed (xim. GetImage (), 32, 42, xim. GetWidth (), xim. GetHeight ());

Lub tsev qiv ntawv, raws li nws tuaj, kuj tau muab cov duab plaub puv nkaus, tab sis hav, Kuv xav tau qhov ntxoov ntxoo, yog li kuv tau ntxiv txoj hauv kev tshiab. Peb yuav ua ob daim duab plaub ntxiv, ib qho ntxoov ntxoo thiab ib qho puv, thiab tso lawv mus rau sab xis ntawm thawj tus, hloov lawv dub thiab liab.

// Duab ntxoov ntxoo Rectange pleev xim kom meej (tsis hloov); paint. DrawShadedRectangle (5, 3, 35, 33); epd. SetPartialWindowBlack (xim. GetImage (), 72, 42, xim. GetWidth (), xim. GetHeight ()); // Sau cov duab plaub plaub. Clear (tsis hloov); paint. DrawFilledRectangle (5, 3, 35, 33, COLORED); epd. SetPartialWindowRed (xim. GetImage (), 112, 42, xim. GetWidth (), xim. GetHeight ());

Kauj Ruam 8: Teeb Duab Lub Vev Xaib

Teeb duab voj voog
Teeb duab voj voog

Cov voj voos tsuas yog yooj yim los kos. Hloov chaw ntawm kev saib xyuas ntawm ob lub ces kaum, peb yuav tsum tau saib xyuas qhov ua haujlwm ntawm lub hauv paus, thiab lub vojvoog. Peb mam li tshem cov khoom xim tom qab ntawd muab lub voj voos ntawm (20, 15) (txheeb ze rau cov khoom pleev xim) thiab lub vojvoog 15. Thiab rov ua dua rau qhov ntxoov ntxoo thiab puv lub voj voog.

// SECOND ROW

// Lub voj voos xim. Clear (tsis hloov); pleev xim duab kos (20, 18, 15, COLORED); epd. SetPartialWindowBlack (xim. GetImage (), 32, 78, xim. GetWidth (), xim. GetHeight ()); // Duab ntxoov ntxoo lub voj voos xim. Clear (UNCOLORED); xim. DrawShadedCircle (20, 18, 15); epd. SetPartialWindowRed (xim. GetImage (), 72, 78, xim. GetWidth (), xim. GetHeight ()); // Sau lub voj voos xim. Clear (tsis hloov); xim. DrawFilledCircle (20, 18, 15, COLORED); epd. SetPartialWindowBlack (xim. GetImage (), 112, 78, xim. GetWidth (), xim. GetHeight ());

Kauj Ruam 9: UNCOLORED ntawm COLORED Bckground

UNCOLORED ntawm COLORED Bckground
UNCOLORED ntawm COLORED Bckground

Peb tab tom ua nto moo ntawm no! Yog li thaum peb tab tom yob, cia ua 3 lub voj voos ntxiv ntawm kab hauv qab no, lub sijhawm no UNCOLORED ntawm cov xim pleev xim, zoo li peb tau ua nrog kab thib ob ntawm cov ntawv.

// QHOV TSEEB

// Lub voj voos xim. Clear (COLORED); pleev xim rau. epd. SetPartialWindowRed (xim. GetImage (), 32, 114, xim. GetWidth (), xim. GetHeight ()); // Duab ntxoov ntxoo lub voj voos xim. Clear (COLORED) xim. DrawShadedCircle (20, 18, 15); epd. SetPartialWindowBlack (xim. GetImage (), 72, 114, xim. GetWidth (), xim. GetHeight ()); // Sau lub voj voos xim. Clear (COLORED); pleev xim. epd. SetPartialWindowRed (xim. GetImage (), 112, 114, xim. GetWidth (), xim. GetHeight ());

Ntxiv rau qhov ntxoov ntxoo sau, kuj tseem muaj qhov ua rau me me, uas xim xim random. Yog li es tsis yog lub voj voos ntxoov ntxoo saum toj no peb tuaj yeem tso tau

xim. DrawSpeckledCircle (20, 18, 15, 25);

Qhov ntsuas qhov kawg (25) yog qhov ntom ntom, piv txwv li feem pua ntawm cov pixels uas yuav tsum tau xim. Yog tias rho tawm, 50% xav tias yog.

Kuj tseem muaj DrawSpeckledRectangle, nrog rau qhov xav tau tshwj xeeb qhov ntsuas tshwj xeeb ntsuas qhov ntom ntom.

Kauj ruam 10: Kev sib hloov

Kev sib hloov
Kev sib hloov
Kev sib hloov
Kev sib hloov

Txhua yam peb tuaj yeem kos, peb tuaj yeem tig los ntawm 90, 180 lossis 270 degrees. (Peb suav cov kev sib hloov raws lub moos.)

Peb tuaj yeem thov ROTATE cov khoom rau cov xim pleev xim, tab sis nws yog ib qho tseem ceeb kom nkag siab tias nws tsis yog cov xim pleev xim uas tau tig tab sis txhua yam koj sau rau nws. Yog li yog tias koj xav tau cov ntawv ntsug koj yuav tsum teeb tsa koj cov khoom pleev xim kom ntev thiab nyias hauv txoj kab ntsug tsis txhob siv kab rov tav.

Yog li yog tias koj xav kom koj cov ntawv tig ntawm lub kaum sab xis ntawm 90 degrees kom nws nyeem los ntawm saum toj mus rau hauv qab (hloov ntawm sab laug mus rau sab xis), kaum sab xis sab xis saum toj kawg nkaus ntawm cov xim pleev xim yuav yog (0, 0) rau lub hom phiaj ntawm txhua yam koj sau lossis kos rau hauv nws, nrog x mesured los ntawm lub ces kaum qis, thiab y los ntawm lub ces kaum ntawm sab laug.

Tej zaum koj tau pom tias peb tau tso ib qho chaw tseg rau ntawm sab laug sab tes ntawm cov zaub. Yog li cia peb sau qee cov ntawv muaj tig 270 degrees, piv txwv li nyeem los ntawm hauv qab. Qhov no yuav tso (0, 0) ntawm lub kaum sab laug hauv qab.

Nco ntsoov tias txawm li cas los xij koj tig cov khoom pleev xim qhov kev sib hloov tsuas yog siv raws li koj kos pixels rau nws. Thaum koj los sau nws rau lub cuab yeej nws tseem yog cov tswj hwm ntawm lub kaum sab laug tes uas koj yuav tsum muab rau SetPartialWindow.

Yog li txhawm rau rov ua dua, cia teeb tsa peb cov khoom pleev xim kom muaj qhov dav 32 thiab siab 110, thiab peb yuav muab nws ROTATE_270 cov khoom. Tsis yog tias peb yuav tsum ua txhua yam no ua ntej sau lossis kos ib yam dab tsi rau nws.

xim. SetWidth (32);

xim. SetHeight (110); xim. SetRotate (ROTATE_270);

Peb yuav tshem nws mus rau COLORED thiab sau ib txoj hlua uas tsis siv rau nws, tom qab ntawd muab tso rau ntawm (0, 42). (Qhov ntawd yog kaum sab laug sab saum toj, nco ntsoov. Tsis nco qab txog kev sib hloov ntawm cov pixels hauv nws.)

xim. Clear (COLORED); paint. DrawStringAt (8, 8, "Sideways!", & Font16, UNCOLORED); epd. SetPartialWindowBlack (xim. GetImage (), 0, 42, xim. GetWidth (), xim. GetHeight ());

Thaum kawg, peb yuav tsum qhia lub cuab yeej kom pom txhua lub pixels peb tau muab rau nws. Thiab yog tias peb tsis xav hloov nws ib pliag thiab xav khaws lub roj teeb lub zog peb tuaj yeem tso nws tsaug zog, thiab vim li cas ho tsis tso Arduino kom tsaug zog ib yam, kom sawv thaum nws txog sijhawm coj thiab tso saib lwm qhov. ntsuas.

epd. DisplayFrame ();

pw tsaug zog ();

Qhov piv txwv thib ob kos duab qhia pom kev sib hloov los ntawm 90, 180 thiab 270 degrees. Txog tam sim no koj yuav tsum muaj peev xwm ua raws nws ntawm koj tus kheej.

Kauj ruam 11: Teeb duab Bitmaps

Teeb duab Bitmaps
Teeb duab Bitmaps

Tus neeg muag khoom qhov demo suav nrog tso saib ob peb ntawm cov duab bitmap. Cov no yog qhov yooj yim los tsim siv cov cuab yeej uas tuaj yeem rub tawm los ntawm

www.buydisplay.com/image2lcd

Nws los ua zip cov ntaub ntawv uas muaj.exe install file thiab cov ntawv uas muaj daim ntawv tso cai yuam sij. Nthuav nws tom qab ntawd ob npaug rau nyem rau ntawm cov ntaub ntawv.exe rau nruab nws.

Kom meej meej, muaj kev txwv nruj heev rau yam uas koj tuaj yeem pom txij li E-number pixels tuaj yeem tsuas yog nyob rau lossis tawm thiab yog li tsis tuaj yeem sawv cev rau qib ntawm grey. Tab sis nws muaj peev xwm muab cov duab pleev xim rau ua duab. Koj yuav xav pom lub logo, cim, lossis cov ntawv ruaj khov hauv cov ntawv zoo nkauj, mus rau qhov uas koj tuaj yeem sau cov ntawv sib txawv lossis cov duab xws li kab ntawv lossis kab ntawv ncuav qab zib, tej zaum qhia qee yam xws li qib kua.

Koj tuaj yeem tsim koj cov duab nrog txhua yam duab kos uas koj tau paub, lossis koj tuaj yeem luam theej duab hauv daim duab lossis kos duab, tab sis txawm li cas los xij koj yuav tsum muaj peev xwm txo qis nws tsuas yog 2 qib. Txuag nws li.gif,-j.webp

Tua tawm Image2Lcd. Nrog rau hauv qab, koj yuav pom Daim Ntawv Teev Npe. Nyem rau ntawm qhov no thiab nkag mus rau tus lej sau npe uas tuaj hauv cov ntawv hauv kab ntawv zip uas koj rub tawm. Qhov no yuav tshem tawm cov txheej txheem ntawm daim duab.

Hauv Image2Lcd, qhib koj daim ntawv duab. Nyob rau sab laug tes, xyuas kom koj muaj

  • Tso zis filetype: C array
  • Hom scan: Kab rov tav Scan
  • BitsPixel: Monochrome
  • Max Dav thiab Qhov Siab: qhov loj ntawm koj cov zaub, thiab
  • Suav nrog cov ntaub ntawv hauv taub hau yuav tsum tsis raug txheeb xyuas.

Nyem lub pob nyob ib sab ntawm Max Dav thiab Qhov Siab kom ua. Qhov tshwm sim ntawm kev ua yuav raug qhia. Tej zaum koj yuav tsum tau kho qhov Brightness thiab Contrast sliders kom tau txais txiaj ntsig zoo tshaj plaws.

Nyem Rov qab xim checkbox saum lub Brightness slider, ua rau nws tsis zoo duab, uas rau qee qhov laj thawj tsim nyog, tom qab ntawd nyem Txuag kom txuag nws li imagedata.cpp hauv daim nplaub tshev uas muaj koj daim duab Arduino. Lwm lub sijhawm koj qhib daim duab nrog Arduino IDE koj yuav tsum pom nws zoo li tab tshiab.

Kauj Ruam 12: Qhia Koj Li Bitmap

Qhia Koj Li Bitmap
Qhia Koj Li Bitmap

Hauv cov ntawv tseem ceeb ntawm koj daim duab kos Arduino, tam sim tom qab kab #suav nrog cov kab saum toj kawg nkaus, ntxig:

#suav nrog "imagedata.h"

Tsim ib lub tab tshiab (nyem lub xub xub ntawm qhov kawg ntawm kab tabs) thiab hu nws imagedata.h. Ntxig cov kab 2 hauv qab no hauv nws:

extern const unsigned char IMAGE_BLACK ;

extern const unsigned char IMAGE_RED ;

Hauv koj cov ntaub ntawv imagedata.cpp, thawj kab yuav pib nrog

const tsis kos npe char gImage_image [2888] = {

(Tus lej hauv kab zauv yuav txawv yog tias koj tsis siv 1.54 zaub.) Hloov qhov no los ntawm

const unsigned char IMAGE_BLACK PROGMEM = {

Qhov no yog rau cov duab dub thiab dawb. Yog tias koj xav kom nws liab thiab dawb, hloov nws mus

const unsigned char IMAGE_RED PROGMEM = {

Ua ntej kab no, ntxiv

#suav nrog

#suav nrog "imagedata.h"

Tam sim no koj tau npaj los tso koj cov duab. Hauv lub voj () hauv koj cov ntaub ntawv tseem ceeb, ntxiv

epd. ClearFrame ();

epd. DisplayFrame (IMAGE_BLACK, NULL);

Lossis, yog nws yog daim duab liab uas koj tau tsim, kab thib ob yuav tsum yog

epd. DisplayFrame (NULL, IMAGE_RED);

Qhov tseeb koj tuaj yeem tsim cov duab liab thiab dub ua ke los ntawm kev hloov cov xim liab thiab dub cais nrog Image2Lcd, thiab tso saib ob qho tib si nrog

epd. DisplayFrame (IMAGE_BLACK, IMAGE_RED);

Txawm li cas los xij, txhua lub pixels uas tau teev tseg ob qho tib si dub hauv cov duab dub thiab dawb, thiab liab hauv liab thiab dawb ib, yuav tawm liab.

Thaum kawg, koj tuaj yeem thaub qab koj cov duab nrog ib qho ntawm cov ntawv lossis cov duab ua haujlwm peb tau kawm txog ua ntej. Kuv xav ntxiv kuv li Twitter tuav, yog li kuv ntxiv

Xim xim (duab, 20, 152); // dav yuav tsum yog ntau ntawm 8

xim. SetRotate (ROTATE_270); xim. Clear (tsis hloov); paint. DrawStringAt (20, 2, "@pleriche", & Font16, COLORED); epd. SetPartialWindowRed (xim. GetImage (), 0, 0, xim. GetWidth (), xim. GetHeight ()); epd. SetPartialWindowRed (xim. GetImage (), 0, 0, xim. GetWidth (), xim. GetHeight ()); epd. DisplayFrame ();

Pom zoo: