Cov txheej txheem:

BluBerriSix - TFT TouchScreen / Arduino Qhia: 12 Kauj Ruam (nrog Duab)
BluBerriSix - TFT TouchScreen / Arduino Qhia: 12 Kauj Ruam (nrog Duab)

Video: BluBerriSix - TFT TouchScreen / Arduino Qhia: 12 Kauj Ruam (nrog Duab)

Video: BluBerriSix - TFT TouchScreen / Arduino Qhia: 12 Kauj Ruam (nrog Duab)
Video: bluBerriSIX - Arduino TFT Project - Happy 20th Birthday Blackberry 850! 2024, Hlis ntuj nqeg
Anonim
BluBerriSix - TFT TouchScreen / Arduino Tutorial
BluBerriSix - TFT TouchScreen / Arduino Tutorial
BluBerriSix - TFT TouchScreen / Arduino Tutorial
BluBerriSix - TFT TouchScreen / Arduino Tutorial

2019 yog hnub tseem ceeb thib ob ntawm RIM Blackberry 850! Qhov kev tsim Canadian me me no tau hloov txoj kev sib tham hauv ntiaj teb. Nws tau ploj mus ntev, tab sis nws cov keeb kwm tseem txuas ntxiv!

Hauv cov lus qhia no, koj yuav kawm paub siv MCUfriend.com 2.4 TFT cov ntaub thaiv npog rau Uno/Mega. lub vijtsam zoo ib yam li Adafruit thiab lwm yam TFT daim thaiv/cov ntxaij vab tshaus.

Peb yuav tsim qhov yooj yim 2 app version ntawm kuv bluBerriSIX kos duab.

Cia peb pib!

Kauj ruam 1: BluBerriSIX - Txheej txheem cej luam

Image
Image
BluBerriSIX - Txheej txheem cej luam
BluBerriSIX - Txheej txheem cej luam
BluBerriSIX - Txheej txheem cej luam
BluBerriSIX - Txheej txheem cej luam

BluBerriSIX app yog rau qhov ua haujlwm TFT txoj haujlwm.

Nws suav nrog:

Lub teeb nyem

Saucy '7' app (zoo li Khawv koob '8' Pob)

Ib lub laij lej

Ib qho Kev Ntsuas Kev Ntsuas app siv SR-04 ultrasonic nrug deb sensor

Qhov Kub thiab Vaum app uas tseem ua cov ntaub ntawv teev sijhawm tiag tiag txog li 1.5km nrog HC-12 transceiver

Ib daim ntawv thov siv HC-12.

Txoj haujlwm no coj 1100 kab ntawm txoj cai. Peb yuav tsim qhov yooj yim dua qhov uas tseem qhia txog TFT zaub thiab kov cov ntsiab lus paub.

Kauj Ruam 2: Dab Tsi Xav Tau?

Dab Tsi Xav Tau?
Dab Tsi Xav Tau?
Dab Tsi Xav Tau?
Dab Tsi Xav Tau?

- Ib qho Arduino Uno lossis Mega 2560

- MCUfriend 2.4 TFT daim thaiv

Cov tsev qiv ntawv hauv qab no:

- Adafruit_GFX lub tsev qiv ntawv

- Adafruit Touchscreen lub tsev qiv ntawv

- MCUFRIEND_kbv lub tsev qiv ntawv

Cov tsev qiv ntawv no tuaj yeem teeb tsa nrog Tus Thawj Saib Xyuas Tsev Kawm Ntawv sab hauv Arduino IDE.

Txhawm rau thauj lub tsev qiv ntawv, mus rau Sketch -> Xws li Lub Tsev Qiv Ntawv -> Tswj Cov Tsev Qiv Ntawv… ntawv xaiv.

Hauv qhov 'lim koj tshawb fawb …' teb, nkag mus rau thawj ob peb lub cim ntawm lub tsev qiv ntawv lub npe thiab tom qab ntawd xaiv thiab teeb tsa lub tsev qiv ntawv tsim nyog. Thaum ua tiav, tsuas yog rov qab koj txoj kev tawm ntawm qhov screen no.

Thaum teeb tsa daim iav TFT ntawm Uno/Mega, Ua tib zoo saib xyuas kom ntseeg tau tias koj tab tom txuas cov pins kom raug. Kuv misaligned kuv thawj daim ntaub thaiv thiab kib nws. Kuv siv ob lub lis piam ntawm kev ntxhov siab zuj zus sim nrhiav cov tsev qiv ntawv raug ua ntej paub tias lub vijtsam tuag. Ceev faj

Kauj Ruam 3: Peb Txoj Haujlwm

Peb Txoj Haujlwm
Peb Txoj Haujlwm
Peb Txoj Haujlwm
Peb Txoj Haujlwm
Peb Txoj Haujlwm
Peb Txoj Haujlwm
Peb Txoj Haujlwm
Peb Txoj Haujlwm

Peb yuav tsim qhov yooj yim dua ntawm bluBerriSIX kos duab.

Nws yuav muaj, - lub vijtsam txaws

- lub vijtsam zaub mov tseem ceeb nrog ob lub khawm

- Saucy 7 app

- ib qho yooj yim nkag nkag app

Koj tseem yuav tuaj yeem rov qab mus rau cov ntawv qhia zaub mov tseem ceeb los ntawm nias lub 'Tsev' lub cim nyob rau sab laug ntawm qhov khoom tshwj xeeb no. Yog tias koj tsis muaj lub cim zoo li no, koj tsuas yog yuav tsum txhais lub cheeb tsam 'tsev' ntawm koj lub vijtsam. Koj yuav kawm paub yuav txiav txim li cas thaj tsam kov screen hauv qhov kev qhia no.

Txawm hais tias qhov no yog qhov haujlwm yooj yim dua, nws tseem ntev dua. Kuv yuav muab cov qauv ntawm Arduino sketches ntawm txhua theem loj yog li koj tuaj yeem upload lawv yog tias koj xav tau.

Kauj Ruam 4: Txoj Cai Header, Cov Hloov Ntiaj Teb, Kev Teeb Meem

Lub taub hau Code, Ntiaj teb sib txawv, teeb tsa Screen
Lub taub hau Code, Ntiaj teb sib txawv, teeb tsa Screen
Lub taub hau Code, Ntiaj teb sib txawv, teeb tsa Screen
Lub taub hau Code, Ntiaj teb sib txawv, teeb tsa Screen

Tag nrho txoj haujlwm tau sau tseg zoo heev. Tab sis cov ntsiab lus ua raws.

Pib qhov tshiab Arduino project thiab hu nws 'tft demo' lossis lwm lub npe koj xav tau.

Thawj lub vaj huam sib luag saum toj no qhia peb txhais cov ntiaj teb sib txawv. Peb kuj ntxiv hauv cov tsev qiv ntawv peb yuav xav tau siv rau ob qho tib si ua haujlwm ntawm lub vijtsam thiab kov pom ntawm lub vijtsam.

Peb kuj tseem txhais cov Analog Pins nrog siv rau lawv lub hom phiaj tshwj xeeb ntawm kev tshuaj ntsuam.

Peb txhais tft khoom (zaub) thiab ts khoom (kov) raws li cov neeg ua haujlwm rau lawv cov haujlwm.

Peb txhais qee qhov 16 xim me ntsis kom ua kom yooj yim los ua xim rau lub vijtsam thiab rau cov ntawv thiab cov khoom duab. Koj yuav pom muaj qhov URL mus rau lub vev xaib uas muaj Xim Xim Xaiv thiab hloov pauv kom pom cov xim rau lawv 16 ntsis hexadecimal qhov tseem ceeb. Nws yog ib qho cuab yeej pab tau heev.

Hauv kab ntawv thib ob, peb txhais lub ntiaj teb sib txawv rau peb lub hom phiaj tshwj xeeb app.

CString, tsab ntawv thiab tsab ntawv X thiab tsab ntawv Y cov hlua thiab kab ntawv tau siv rau a) tso tawm cov tsiaj ntawv ntawm cov nyees khawm rau cov ntawv nkag app thiab b) phim tus x thiab y tswj hwm ntawm kev kov nrog x thiab y tswj hwm ntawm txhua tus ntawv cov keyboard. Xav paub ntau ntxiv txog qhov no thaum peb mus rau ntu ntawm daim duab.

funcX , funcY thiab func yog cov arrays uas ua haujlwm los txiav txim seb lub pob app twg raug nias ntawm lub vijtsam tseem ceeb ntawm lub vijtsam thiab tom qab ntawd siv cov ntaub ntawv ntawd los qhib lub app sib xws.

lastTouch thiab tThresh tau siv hauv txoj kev kov kom paub tseeb tias peb tsis tau txais ntau yam kov los ntawm kev nias lub vijtsam ntev dhau. Ntxiv rau qhov ntawd tom qab.

Hom kev hloov pauv yuav tswj hwm lub vijtsam twg thiab tMode sib txawv yuav tswj hwm txoj kev kov twg uas tau siv nyob rau txhua lub sijhawm.

Hauv kev teeb tsa () thaiv, peb qhib Serial channel yuav tsum peb xav siv Serial.println () cov lus txib rau kev debugging. Koj tsis xav tau kab no yog tias koj tsis xav ua Serial Monitor debugging.

Plaub kab tom ntej no tsuas yog teeb tsa tus lej rau cov khoom tft.

Tom ntej no peb teeb tsa kev taw qhia ntawm lub vijtsam rau hom Portrait.

RandomSeed () hais kom ua tsuas yog pib lub tshuab hluav taws xob tus lej rau siv tom qab los ntawm Saucy 7 app.

Thaum kawg peb hu xov tooj rau txheej txheem txaws.

Kauj Ruam 5: Tsim Lub Vijtsam Spash thiab nkag siab Zaub piv rau Touch Mapping

Tsim lub Spash Screen thiab nkag siab Zaub piv rau Touch Mapping
Tsim lub Spash Screen thiab nkag siab Zaub piv rau Touch Mapping
Tsim lub Spash Screen thiab nkag siab Zaub piv rau Touch Mapping
Tsim lub Spash Screen thiab nkag siab Zaub piv rau Touch Mapping

Tam sim no peb yuav pib tsim lub tshuab ntxhua khaub ncaws.

Tab sis ua ntej, thov saib daim duab rau lub vijtsam thiab kov daim duab qhia chaw. Daim ntawv ceeb toom tias lub hauv paus chiv keeb nyob hauv ntau qhov chaw. Txog kev tso saib, keeb kwm (0, 0) yog nyob rau sab laug sab saum toj ntawm lub vijtsam (thaum khawm RESET nyob saum) thiab loj hlob los ntawm sab laug mus rau sab xis thiab sab saud mus rau hauv qab.

Txog kev txheeb xyuas qhov kov, keeb kwm yog nyob rau hauv kaum sab laug ntawm lub vijtsam thiab loj hlob los ntawm sab laug mus rau sab xis thiab hauv qab mus rau saum.

Yog li DISPLAY AND TOUCH MAPS YOG DEFINED SEPARATELY thiab muaj kev daws teeb meem sib txawv. Cov zaub muaj kev daws teeb meem ntawm 240 los ntawm 320 thiab qhov kov muaj qhov kev daws teeb meem ntau dua li koj yuav pom sai sai no.

Mus rau thaj tsam ntawm koj daim duab kos hauv qab lub voj () {} txoj kev thiab peb yuav nkag mus rau qhov txaws () txheej txheem txheej txheem.

Peb pib los ntawm kev ua fillScreen () hais kom ua lub vijtsam nrog cov xim dawb uas peb tau hais tseg hauv kab ntawv header.

Tom qab ntawd peb teeb cov ntawv me me rau '5'. Nov yog qhov loj me ntawm cov ntawv loj. Peb teeb tsa x thiab y txoj haujlwm rau tus ntawv cursor thiab peb teeb cov ntawv xim. Thaum kawg luam tawm ("TFT") hais kom ua qhov xim xiav, loj '5' ntawv ntawm txoj haujlwm tshwj xeeb.

Thaum koj nce cov ntawv me me, koj yuav pom tias cov cim tau ntau zuj zus. Yog li mus saum 5 yog tej zaum tsis muaj txiaj ntsig. Thaum kawg ntawm qhov kev qhia no, kuv yuav qhia koj li cas siv bitmap fonts kom tau txais cov ntawv zoo nyob hauv koj li kev siv. Qhov kev pauv yog tias siv bitmap font teeb tsa siv ntau lub cim xeeb hauv koj Arduino uas yuav txwv koj qhov ntau thiab tsawg

Peb rov hais dua cov lus txib zoo sib xws rau lwm ob kab ntawv ntawm cov ntawv tawg.

Thaum kawg peb ncua sijhawm 2.5 vib nas this los muab sijhawm rau tus neeg siv los nyeem cov lus ntawm lub vijtsam ua ntej lub app txav mus rau lub vijtsam tseem ceeb.

Mus tom ntej thiab xa cov duab kos no rau koj Arduino. Nws yuav tsum tso saib qhov screen txaws.

Kauj Ruam 6: Ua Kov Mapping Diagnostic Tool

Ua Kov Mapping Diagnostic Tool
Ua Kov Mapping Diagnostic Tool
Ua Kov Mapping Diagnostic Tool
Ua Kov Mapping Diagnostic Tool

ShowTouch () txoj hauv kev muaj txiaj ntsig zoo los pab koj kom tau txais kev sib koom tes ntawm qhov sib txawv ntawm qhov screen. Koj yuav tsum tau ua qhov no txhawm rau txheeb xyuas thaj tsam kov rau koj cov nyees khawm.

Mus tom ntej thiab nkag mus rau txoj hauv kev no hauv qab koj qhov txaws () txoj kev ua tiav yav tas los.

Nov yog nws ua haujlwm li cas.

Cov lus hais yog txiav txim siab yog tias lub sijhawm txaus dhau los txij li qhov kov kawg. Nws siv lub sijhawm tam sim no lub sijhawm millis () thiab rho tawm lub sijhawm kawg Touch. Yog tias nws ntau dua li tThresh tus nqi (200 milliseconds), nws lees txais qhov kov. Txwv tsis pub, nws yuav tsis quav ntsej cov xwm txheej cuam tshuam ntau.

Tom ntej no, getpoint () hais kom tau x, y thiab z tswj hwm ntawm qhov kov. Kev sib koom tes z yog ntsuas kev ntsuas siab.

Yog tias qhov siab nyob hauv qhov siab tshaj plaws thiab qhov tsawg kawg nkaus peb tau hais hauv daim duab kos, lub hauv paus yuav hloov pauv thawj YP thiab XM rov qab rau OUTPUT, tso lub vijtsam hauv hom DISPLAY.

Tom ntej no nws yuav kos lub duab plaub dawb kom tshem tawm cov kev tswj hwm uas tej zaum yuav tau tshwm sim yav dhau los.

Cov duab kos tom qab teeb tsa tus tsiaj ntawv rau qhov loj 2, xim dub thiab nthuav qhia x (p.x) thiab y (p.y) tswj hwm ntawm lub vijtsam. Tom qab ntawd koj tuaj yeem sau ntawv ceeb toom ntawm cov chaw no los pab koj ua haujlwm rau koj thaj chaw kov rau koj tus kheej daim duab.

Yog tias nqe lus hauv qab ntawm txoj hauv kev txheeb xyuas seb lub pob 'Tsev' ntawm lub vijtsam raug nias. cov '<=' cov neeg ua haujlwm tso cai rau qhov dav thiab siab ntawm Lub Tsev khawm. Cov kev tswj hwm tau teev tseg yog x-center thiab y-center tswj hwm ntawm Lub Tsev khawm. Yog tias nws tau nyem, hom tau teeb tsa rau 0 uas thaum kawg yuav txhais tau tias 'Mus rau Lub Vev Xaib Tseem Ceeb'. Ntxiv rau qhov ntawd tom qab.

Thaum kawg peb hloov kho LastTouch rau lub sijhawm tam sim no lub sijhawm millis () kom tau npaj rau qhov tshwm sim tom qab.

Thov tam sim no mus rau lub voj () thaiv thiab ntxiv kab showTouch ();

Txij ntawm no mus, rub koj daim duab thiab sim nws. Nws yuav kos lub vijtsam tawg thiab yog tias koj pib kov lub vijtsam, TOUCH x thiab y cov haujlwm yuav tshwm ntawm qhov screen.

Ua ntej txav mus, cia rov los saib dua ob kab tseem ceeb ntawm txoj cai:

tus pinMode (YP, OUTPUT); // rov kho TFT tswj tus pin

pinMode (XM, OUTPUT); // rau zaub tom qab kuaj pom qhov kov

Txhua lub sijhawm koj xav pom qee yam ntawm lub vijtsam, koj YUAV TSUM ua ob qho lus txib no los hloov lub vijtsam los ntawm KOV hom mus rau DISPLAY hom. Txwv tsis pub, koj cov lus txib ua haujlwm yuav tsis ua haujlwm.

Ua tau zoo txog tam sim no! Mus so!

Kauj Ruam 7: Tsim Lub Vev Xaib Lub Ntsiab Tseem Ceeb

Tsim Lub Vev Xaib Main Screen
Tsim Lub Vev Xaib Main Screen
Tsim Lub Vev Xaib Main Screen
Tsim Lub Vev Xaib Main Screen
Tsim Lub Vev Xaib Main Screen
Tsim Lub Vev Xaib Main Screen

Tam sim no peb yuav tsim peb Lub Vev Xaib Lub Vev Xaib nrog ob lub khawm koj tuaj yeem nias kom qhib txhua lub app. Txoj hauv kev yog hu ua menuScreen ().

Peb pib los ntawm kev tso lub vijtsam hauv DISPLAY hom.

Tom qab ntawd peb teeb tsa tus ntawv loj, xim thiab txoj haujlwm thiab luam tawm 'Cov Ntawv Qhia Ua Ntej' '.

Tam sim no peb kos ob lub duab plaub uas yog cov nyees khawm.

Txhua daim duab qhia muaj cov qauv zoo sib xws:

graphicShape (x koom tes, y koom tes, dav, siab, COLOR)

- x kev sib koom tes - sab saum toj sab laug rau cov khoom sib dhos, nruab nrab rau cov voj voos

- y sib koom ua ke - sab laug sab saum toj rau cov khoom sib dhos, nruab nrab rau cov voj voos

- dav - dav ntawm cov khoom hauv pixels

- COLOR - xim tsis tu ncua uas peb tau hais hauv lub taub hau

Thaum kawg peb hu ob txoj hauv kev los kos Saucy 7 lub cim thiab QWERTY Text Entry icon. Cov no yog cov txheej txheem cais.

Draw7icon (0) txoj hauv kev siv tus lej ntsuas uas yog y-offset rau kos lub pob. Peb ua qhov no kom peb tuaj yeem siv tib txoj hauv kev rau kos lub pob ntawm cov ntawv qhia zaub mov THIAB ntawm Saucy 7 app screen. Qhov offset tsuas yog tso cai rau peb kho qhov kev sib koom ua ke ntawm lub pob nce lossis nqis.

Txoj kev kos 7Ball (0) yog hu los ntawm hauv draw7Icon (0). Nws kuj tseem siv qhov ntsuas uas tso cai rau peb hloov kho txoj haujlwm ntsug ntawm lub pob nyob ntawm seb peb kos nws ntawm cov ntawv qhia zaub mov lossis ntawm lub vijtsam app.

FillCircle () hais kom siv 4 qhov kev sib cav.

- x kev koom tes ntawm qhov chaw nruab nrab ntawm lub voj voog

- y koom tes ntawm qhov chaw nruab nrab ntawm lub voj voog

- Lub vojvoog ntawm lub voj voog (hauv pixels)

- COLOR - xim tsis tu ncua uas peb tau hais hauv lub taub hau

Thaum kawg txoj kev kos duabTextIcon () hu ua kos lub cim rau cov ntawv nkag app.

Koj tuaj yeem sim ua txoj hauv kev los ntawm kev tawm tswv yim tawm () txoj hauv kev teeb tsa () thiab ntxiv menuScreen ().

Rub cov duab kos rau koj Arduino thiab sim nws!

Kauj Ruam 8: Saucy 7 App thiab Cov Ntawv Qhia Tseem Ceeb

Saucy 7 App thiab Cov Txheej Txheem Qhia Ntawv Tseem Ceeb
Saucy 7 App thiab Cov Txheej Txheem Qhia Ntawv Tseem Ceeb
Saucy 7 App thiab Cov Txheej Txheem Qhia Ntawv Tseem Ceeb
Saucy 7 App thiab Cov Txheej Txheem Qhia Ntawv Tseem Ceeb
Saucy 7 App thiab Cov Txheej Txheem Qhia Ntawv Tseem Ceeb
Saucy 7 App thiab Cov Txheej Txheem Qhia Ntawv Tseem Ceeb
Saucy 7 App thiab Cov Txheej Txheem Qhia Ntawv Tseem Ceeb
Saucy 7 App thiab Cov Txheej Txheem Qhia Ntawv Tseem Ceeb

Qhov xyaScreen () txoj hauv kev yuav kos lub vijtsam rau lub app, suav nrog kos lub pob thiab tom qab ntawd tso tawm cov lus qhia.

Xya txoj hauv kev () txoj hauv kev qhia cov lus qhia ntxiv rau tshem tawm lub vijtsam los ntawm cov lus teb yav dhau los. Nws tseem kos lub pob 'Teb'.

Show7Response () txoj hauv kev daws teeb meem yav dhau los cov lus teb los ntawm lub vijtsam, tso tawm ib qho kev xav "xav …" cov lus thiab tom qab ntawd tso saib cov lus teb uas raug xaiv.

read7Touch () yog txoj hauv kev uas tos rau qhov xwm txheej kov los tsim cov lus tsim tawm. Cov lej kov zoo ib yam li showTouch () txoj kev kuaj mob piav qhia ua ntej. Txhawm rau kom yooj yim, txoj hauv kev yuav lees txais qhov kov nyob txhua qhov chaw ntawm lub vijtsam raws li lub pob "Teb".

Nyob rau sab saum toj ntawm txoj kev, peb txhais cov lus teb kab ntawm cov hlua uas yog cov lus uas tuaj yeem tsim los ntawm kev sib tham tshwm sim.

Yog tias Lub Tsev Lub Tsev raug nias, nws yuav xaus lub app thiab rov qab mus rau lub vijtsam tseem ceeb. Txwv tsis pub, txoj hauv kev yuav tsim tus lej tsis sib xws ntawm 0 thiab 7 (tshwj xeeb) thiab hla cov lus sib tham los ntawm cov lus teb array rau show7Response () txoj kev.

Thaum kawg, lub backToMenu () txoj hauv kev saib rau qhov kov ntawm Lub Tsev khawm thiab rov qab tswj mus rau lub ntsiab zaub mov screen.

ReadMenuTouch () txoj hauv kev saib rau qhov tshwm sim kov thaum koj nyob ntawm lub vijtsam tseem ceeb. Thaum kov tau pom, nws hla x thiab y ua haujlwm mus rau txoj kev getFunc (x, y) uas zoo li hauv funcX thiab funcY cov kab kom phim x thiab y tswj hwm ntawm qhov kov. Nws mam li rov qab tus lej los ntawm func array rau lub app uas tau xaiv. '1' yog Saucy 7 thiab '2' yog cov ntawv nkag app. Tom qab ntawd nws teeb tsa hom rau tus app tus nqi kom lub app yuav ua tiav.

Kauj Ruam 9: Lub Loop () Thaiv

Loop () Thaiv
Loop () Thaiv

Peb tam sim no yuav pib tsim lub voj () thaiv txoj cai los daws teeb meem lub vijtsam uas tsim nyog thiab tom qab ntawd hu rau txoj kev kov uas tsim nyog raws li qhov kev xaiv tam sim no tau xaiv.

Lub voj () txoj kev muaj ob txoj kev hloov () cov qauv.

Cov txheej txheem hloov pauv sab saum toj saib xyuas lub vijtsam tsim nyog nyob ntawm seb qhov kev xaiv twg raug xaiv. Nws kuj teeb tsa tMode tus nqi rau qhov tsim nyog kov txoj hauv kev los ua haujlwm rau qhov kev xaiv tam sim no. Thaum kawg nws teeb tsa tus qauv tus nqi rau 9 kom lub vijtsam zaub tsis tas rov ua dua tshiab.

Kev hloov pauv hauv qab tswj hwm uas kov cov txheej txheem tau ua tiav raws li tus neeg siv xaiv app xaiv raws li sawv cev los ntawm tus nqi ntawm tMode.

Thauj cov duab kos rau hauv koj Arduino thiab koj yuav tsum muaj peev xwm xaiv thiab siv Saucy 7 app.

Koj tau ua haujlwm ntau heev! So ib pliag:-)

Kauj Ruam 10: Cov Ntawv Nkag Nkag App - Peb Nyob Hauv Tsev Ncab

Cov Ntawv Nkag Nkag App - Peb Nyob Hauv Tsev Ncab!
Cov Ntawv Nkag Nkag App - Peb Nyob Hauv Tsev Ncab!
Cov Ntawv Nkag Nkag App - Peb Nyob Hauv Tsev Ncab!
Cov Ntawv Nkag Nkag App - Peb Nyob Hauv Tsev Ncab!
Cov Ntawv Nkag Nkag App - Peb Nyob Hauv Tsev Ncab!
Cov Ntawv Nkag Nkag App - Peb Nyob Hauv Tsev Ncab!
Cov Ntawv Nkag Nkag App - Peb Nyob Hauv Tsev Ncab!
Cov Ntawv Nkag Nkag App - Peb Nyob Hauv Tsev Ncab!

Tam sim no peb yuav suav nrog cov ntawv nkag app txoj hauv kev.

makeKbd () kos cov keyboard ntawm qhov screen.

Nws kos rau rau ua cov duab sib dhos ua ke thiab tom qab ntawd muab cov ntawv tsim nyog rau ntawm txhua tus 'qhov tseem ceeb' los ntawm kev tau txais tsab ntawv los ntawm txoj hlua cString uas nws luam tawm ntawm lub vijtsam hla tus yuam sij. Daim ntawv ceeb toom tias qhov ntsuas thib ob kawg hauv qhov fillRoundedRect () hais kom ua yog lub vojvoog ntawm txhua lub ces kaum hauv pixels. Qhov siab dua tus nqi no, ntau dua cov ces kaum.

ReadKbdTouch () txoj hauv kev ua haujlwm zoo ib yam li lwm txoj hauv kev nrhiav kom pom.

Yog tias kov tau pom tias tsis yog ntawm Lub Tsev Lub Tsev, nws hla x thiab y ua haujlwm mus rau txoj kev curChar (x, y) uas rov ua tus yam ntxwv uas sib haum rau qhov x thiab y qhov chaw ntawm lub vijtsam. Cov lus uas tau 'ntaus' yog tom qab ntawd tso tawm ntawm lub vijtsam siv 'displayMsg (theChar) txoj kev.

Txoj kev curChar (x, y) tshawb nrhiav los ntawm tsab ntawv X thiab tsab ntawv Y arrays txhawm rau sim nrhiav qhov sib tw uas nyob ze rau x thiab y qhov chaw hla dhau los ntawm readKbdTouch (). Yog tias nws pom qhov sib phim, nws yuav xa tsab ntawv sib xws mus rau readKbdTouch txoj hauv kev. Nco ntsoov tias peb pib lub theChar sib txawv mus rau 32 uas yog ASCII code rau qhov chaw cim, ''. Peb ua qhov no yog tias tus neeg siv kov thaj chaw deb ntawm cov keyboard, nws yuav tsis pom cov cim tsis muaj.

DisplayMsg (theChar) txoj kev coj tus cwj pwm xa rov qab los ntawm curChar (x, y) thiab txuas ntxiv nws mus rau kab lus. Nws mam li qhia cov lus ntawm qhov screen.

Thaum kawg, peb yuav hloov kho lub voj () thaiv kom lees txais cov ntawv nkag app xaiv.

Rub tawm daim duab tftDemo rau koj Arduino thiab koj yuav tsum muaj peev xwm siv daim ntawv thov tiav.

Nrog koj zoo siab! koj tau tsim TFT touchscreen app! Siv sijhawm so hnub so!

Kauj Ruam 11: Ua kom nrawm! - Siv Adafruit Bitmap Fonts hauv Koj Daim Duab

Tus txheej txheem tft font teeb tau zoo. Tab sis nws yog qhov zoo dua yog tias peb tuaj yeem siv cov ntawv me me uas tsim nyog hauv peb daim duab TFT.

Qhov tsis zoo yog qhov chaw thau khoom font teev rau hauv Arduino nco tau siv qhov chaw tseem ceeb. Qhov tseeb, nws yooj yim heev los sau koj cov duab kos nrog ntau tus fonts uas nws yuav tsis thauj mus rau Arduino.

Cov ntawv muaj nyob hauv Adafruit_GFX lub tsev qiv ntawv tais ceev tseg uas koj twb tau teeb tsa rau txoj haujlwm no. Ib qho kev qhia zoo heev ntawm kev siv fonts yog ntawm lub xaib no.

Hauv cheeb tsam Header ntawm koj daim duab, ntxiv cov ntawv siv rau tus font uas koj xav siv. Peb yuav siv FreeSerifBoldItalic18p7b font rau qhov piv txwv no.

#suav nrog

Hauv koj qhov txaws () txoj hauv kev, tawm tswv yim tawm tft.setTextSize (); hais kom ua

Ntxiv cov lus txib hauv qab no,

tft.setFont (& FreeSerifBoldItalic18pt7b);

Tam sim no ib qho luam tawm () cov lus txib yuav siv cov ntawv teev tseg tam sim no. Txhawm rau hloov mus rau lwm tus font, koj yuav siv lwm tft.setFont () hais kom ua nrog cov ntawv tom ntej uas koj xav siv.

Txhawm rau teeb cov font rov qab rau tus qauv tft font, tsuas yog siv tft.setFont (); hais kom ua yam tsis muaj qhov ntsuas.

Tshaj tawm cov duab kos rau koj Arduino thiab koj yuav tsum pom lub vijtsam txaws tam sim no siv cov ntawv bitmap rau ua cov ntawv ntawm lub vijtsam. Koj yuav pom tias qhov loj me ntawm daim duab yog qhov loj dua tam sim no uas koj tau suav nrog tus tsiaj ntawv.

Kauj Ruam 12: Kev Xav Thaum Kawg

Muaj ntau ntau lwm yam duab nraaj lus txib muaj rau koj. Lawv suav nrog:

tft.drawRect (x, y, dav, siab, COLOR);

tft.drawLine (x1, y1, x2, y2, COLOR);

Cov piv txwv hauv qab no siv tft.color565 txoj hauv kev los qhia rau koj paub cov xim raws xim liab, ntsuab thiab xiav qhov tseem ceeb. Nov yog lwm txoj hauv kev los siv qhov kev txhais tas li HEX xim qhov peb siv hauv peb daim duab.

tft.drawRoundRect (x, y, dav, siab, vojvoog, tft.color565 (255, 0, 0)); // qhov no yuav liab

tft.drawCircle (x, y, radius, tft.color565 (0, 255, 0)); // qhov no yuav ntsuab

tft.drawTriangle (vertex1x, vertex1y, vertex2x, vertex2y, vertex3x, vertex3y, tft.color565 (0, 0, 255)); // xiav

tft.fillTriangle (vertex1x, vertex1y, vertex2x, vertex2y, vertex3x, vertex3y, tft.color565 (255, 0, 0);

Ua si ib puag ncig nrog cov lus txib no thiab tshawb xyuas seb lawv tuaj yeem ntxiv rau koj li TFT cov haujlwm.

Kev kawm siv lub vijtsam TFT yog qhov nyuaj thiab koj yuav tsum txaus siab rau koj tus kheej rau kev siv sijhawm los kawm cov thawj kauj ruam no.

Cov ntxaij vab tshaus TFT tuaj yeem ntxiv qhov ntxim nyiam thiab muaj txiaj ntsig Siv Cov Duab Sib Txuas rau koj li Arduino cov haujlwm.

Ua tsaug rau kev ua haujlwm los ntawm kev qhia no.

Tam sim no tawm mus thiab ua ib yam dab tsi zoo dua!

Pom zoo: