Cov txheej txheem:

ESP32 VGA Tetris: 3 Kauj Ruam
ESP32 VGA Tetris: 3 Kauj Ruam

Video: ESP32 VGA Tetris: 3 Kauj Ruam

Video: ESP32 VGA Tetris: 3 Kauj Ruam
Video: When The Quiet Kid Does Your Homework ๐Ÿ’€ #electronics #arduino #engineering 2024, Hlis ntuj nqeg
Anonim
ESP32 VGA Tetris
ESP32 VGA Tetris

Hauv Cov Lus Qhia no Kuv yuav qhia yuav tsim lub clone qhov kev ua si qub Tetris li cas, siv ESP32 thiab tsim cov zis rau VGA saib. Qhov kev ua si no ua tau los ntawm qhov txaus siab ESP32Lib Arduino lub tsev qiv ntawv ua los ntawm bitluni.

Koj yuav xav tau ESP32 pawg thawj coj txhawb kev teeb tsa hauv Arduino IDE (Kuv tab tom siv cov ntawv kawg muaj tam sim no, piv txwv li 1.8.9 IDE). Koj tuaj yeem pom nws hauv Tus Thawj Saib Xyuas Tsev Qiv nrhiav "bitluni". Txij li qhov kawg tau tshaj tawm tsuas yog ob peb lub lis piam dhau los, nws tseem ua haujlwm tab sis nws twb tau muab qee qhov piv txwv yooj yim.

Piv rau kuv cov phiaj xwm yav dhau los uas kuv tau sau cov ntawv zoo sib xws rau cov Arduino lossis ESP8266, ESP32 yog qhov muaj zog tshaj, VGA tso tawm nrog ntau yam kev daws teeb meem (320x200, 320x240, 360x400, 460x480) thiab mus txog 14Bit xim. Tsis tas li ntawd koj muaj kev txiav txim ntawm qhov ntau qhov cim xeeb ntau dua.

Hauv Tetris clone no kuv tsuas yog siv qhov kev daws teeb meem 320x200 nrog 8 xim. Cov cai yog nrawm "hloov pauv" ntawm cov ntawv dhau los rau Arduino VGA, yog li nws tsim tsis zoo thiab tsis ua kom zoo dua. Ntawm qhov tod tes, ESP32 VGA muaj peev xwm muaj peev xwm ntau dua, muab qhov muaj peev xwm los sau ntau dua thiab ntau yam kev ua si sib piv, kuv kwv yees, rau qhov los ntawm DOS era. Kuv cia siab tias txoj haujlwm no yuav siv rau lwm tus tsim kom sau ntau lwm yam kev ua si yav tom ntej.

Kauj Ruam 1: ESP32 Boards, Arduino IDE Installation thiab Configuration

ESP32 Boards, Arduino IDE Kev teeb tsa thiab teeb tsa
ESP32 Boards, Arduino IDE Kev teeb tsa thiab teeb tsa

Ua ntej tshaj plaws koj yuav tsum tau nrhiav ESP32. Muaj ntau ntau yam muaj, tab sis kuv hais kom xaiv ib qho nrog ntau tus pin. Kuv yuav cov version no, tab sis koj tuaj yeem ua tiav peb lwm cov qauv hauv kev piav qhia ntawm daim vis dis aus no.

Muaj ntau txoj hauv kev los ua haujlwm rau ESP32, tab sis ntawm no koj yuav tsum siv qhov tseeb Arduino IDE. Txhawm rau nruab nws, thiab txhawm rau upload bitluni ESP32lib VGA tsev qiv ntawv, koj tuaj yeem ua raws qhov kev qhia yooj yim no. Nws kuj tseem qhia yuav ua li cas txhawm rau koj li ESP32 pawg thawj coj hauv Arduino IDE.

Txij ntawm no mus koj tuaj yeem pib tso thawj tus piv txwv: mus rau Cov Ntaub Ntawv/Piv Txwv/bitluni ESP32Lib/VGA2DFeatures, raws li pom hauv daim duab thaum pib ntawm cov kauj ruam no. Yog tias kev tshaj tawm ua haujlwm yam tsis muaj teeb meem, koj yuav tsum txuas lub VGA chaw nres nkoj raws li qhia hauv qib tom ntej.

Kauj Ruam 2: Txuas VGA thiab Khawm

VGA thiab Khawm Txuas
VGA thiab Khawm Txuas

Txhawm rau txuas VGA saib mus rau ESP32, koj tuaj yeem siv DSUB15 tus poj niam txuas (piv txwv li tus qauv 15 tus pin VGA ib qho) lossis tsuas yog txiav VGA cable.

Rau Tetris, thiab 8 xim piv txwv lub tsev qiv ntawv, koj tsis xav tau ib tus neeg tawm tsam, tsuas yog txuas cov pins raws li hauv qab no:

  • VGA liab rau ESP32 ping G2
  • VGA ntsuab rau ESP32 ping G15
  • VGA xiav rau ESP32 ping G21
  • VGA Hsync rau ESP32 ping G32
  • VGA Vsync rau ESP32 ping G33
  • VGA GND to ESP32 GND

Txij ntawm no koj yuav tsum tuaj yeem pom VGA2DFeatures piv txwv ntawm koj lub VGA saib.

Ua si Tetris, koj xav tau plaub lub khawm thiab plaub tus tiv thaiv ntawm li 1 txog 2 kOhm.

Txuas plaub tus tiv thaiv los ntawm GND mus rau ESP32 tus pin G25, G26, G34 thiab G35.

Txuas ib sab ntawm lub pob rau ESP32 3.3 Volt, thiab lwm sab raws li hauv qab no:

  • khawm sab xis rau G26
  • khawm sab laug rau G34
  • khawm tig mus rau G25
  • khawm mus rau G35

Kauj ruam kawg: rub tawm ESP32_VGA_Tetris_V1.0.ino ntawm qhov kawg ntawm nplooj ntawv no, thiab luam nws daim nplaub tshev uas muaj lub npe qub.

Tshaj tawm nws ntawm ESP32 microcontroller thiab koj tuaj yeem pib ua si Tetris tam sim ntawd!

Kauj Ruam 3: Xaus thiab Txais Kev Pom Zoo

Kuv zoo siab heev rau bitluni, tus sau ESP32 VGA lub tsev qiv ntawv thiab cov lus qhia thiab piv txwv los siv thiab siv nws.

Thov, mus ntsib nws lub vev xaib thiab yees duab kom pom cov ncauj lus kom ntxaws thiab txhua qhov nws muaj peev xwm.

Thaum kawg, yog tias koj nyiam Cov Lus Qhia no, txiav txim siab pov npav rau nws hauv Arduino & microcontrollers kev sib tw!

Pom zoo: