Cov txheej txheem:

Arduino Touchscreen Display: 4 Kauj Ruam
Arduino Touchscreen Display: 4 Kauj Ruam

Video: Arduino Touchscreen Display: 4 Kauj Ruam

Video: Arduino Touchscreen Display: 4 Kauj Ruam
Video: Arduino TFT LCD Touch Screen Tutorial (2.8" ILI9341 Driver) also for ESP32 2024, Hlis ntuj nqeg
Anonim
Arduino Touchscreen Zaub
Arduino Touchscreen Zaub

Nyob zoo! Hnub no, kuv yuav qhia koj yuav siv daim npog Touchscreen nrog Arduino Uno li cas. Koj tuaj yeem siv nws ua qhov me me rau cov lus hais lossis cov duab lossis txhua yam ntawm lwm yam khoom.

Kauj Ruam 1: Qhov Chaw

Qhov
Qhov

Koj yuav xav tau:

  • Arduino Ib
  • Saib Studios TFT Shield
  • USB Cable
  • Micro SD daim npav

Qhov ntawd yog txhua yam koj xav tau. Koj tuaj yeem tau txais daim npog TFT ntawm seeedstudios.com rau 50 daus las. Tom qab koj tau txais daim ntaub thaiv, muab daim npav micro SD tso rau hauv lub qhov me me hauv qab. Tam sim no koj daim iav TFT Kuv npaj rau siv. Txuas nws rau hauv koj Arduino Uno thiab teeb tsa rub tawm cov ntawv teev tseg hauv qab no.

Koj yuav xav tau cov software no thiab cov ntaub ntawv no ib yam:

  • Arduino IDE Cov
  • TFT_Touch_Shield_v2-master-2 lub tsev qiv ntawv (qhov no tuaj yeem rub tawm los ntawm kev pom studios wiki)
  • Txhua yam kev hloov pauv zip

Kauj Ruam 2: Khiav Koj Thawj Txoj Haujlwm TFT

Tam sim no koj muaj txhua ntu thiab software, qhib Arduino IDE thiab qhib

TFT_Touch_Shield_v2-master-2 lub tsev qiv ntawv. Qhib cov piv txwv thiab pom thawj qhov program hu ua "drawCircle". Thaum koj tau qhib qhov haujlwm ntawd, nyeem tag nrho cov ntawv sau cia kom koj nkag siab cov lus txib thiab yuav siv lawv li cas. Muab qhov program tso rau hauv koj lub rooj tsavxwm. Lub Touchscreen yuav tsum tso tawm 4 lub voj voos, 2 sau rau hauv thiab 2 kab lus. Yog tias nws ua tau, Nrog koj zoo siab! Koj nyuam qhuav khiav koj thawj qhov kev pabcuam TFT.

Kauj ruam 3: Ntxiv rau

Ntxiv rau
Ntxiv rau

Vam tias koj nyeem cov ntawv sau ib sab, yog li koj paub siv cov lus txib hauv "drawCircle" program. Tam sim no koj yuav tsum tau siv qhov koj paub los ntawm kev hloov pauv tus lej hauv qee qhov lus txib, yog li koj tuaj yeem pom dab tsi tshwm sim thaum koj ua li ntawd. Sim hloov cooridintaes, qhov loj thiab xim ntawm lub voj voos ntawm lub vijtsam. Nov yog qhov kuv tau ua tom qab kuv kawm paub hloov pauv cov lus txib:

#ncig #ncig

#suav nrog

void teeb tsa () {

TFT_BL_ON;

Tft. TFTinit ();

Tft.fillCircle (110, 150, 100, YELLOW);

Tft.fillCircle (100, 100, 25, BLACK);

Tft.fillCircle (120, 120, 10, RED);

Tft.fillCircle (120, 120, 10, XEEB);

Tft.fillCircle (120, 120, 10, CYAN);

Tft.fillCircle (110, 110, 5, WHITE);

}

void voj () {

}

Yog tias koj tau ua txhua yam ntawd, nws yog lub sijhawm los mus ntxiv. Saib ntawm qee qhov piv txwv kawm paub siv lawv li cas ua ke. Koj yuav tsum zaum kawm cov program uas kos duab lossis cov duab (piv txwv li "kos duab plaub" lossis "kos tus lej").

Kauj ruam 4: Ntxiv rau Contd

Thaum koj tau kawm paub tsim cov duab ntawm lub vijtsam, koj yuav tsum txav mus rau kev kawm txog kev qhia cov duab (drawbmp1 & 2) thiab txog yuav kos li cas ntawm lub vijtsam (pleev xim). Zoo, uas yog zoo nkauj npaum li nws. Ua tsaug rau kev nyeem ntawv thiab yog tias koj ntsaum kuv tshaj tawm lwm cov lus qhia txog qhov no, tsuas yog tawm lus. Ua tsaug rau kev nyeem ntawv!

Pom zoo: