Cov txheej txheem:

Tap Tap Rainbow - a 2 Player Quick Reaction Game: 4 Steps (with Pictures)
Tap Tap Rainbow - a 2 Player Quick Reaction Game: 4 Steps (with Pictures)

Video: Tap Tap Rainbow - a 2 Player Quick Reaction Game: 4 Steps (with Pictures)

Video: Tap Tap Rainbow - a 2 Player Quick Reaction Game: 4 Steps (with Pictures)
Video: Magic Water Marker 2024, Hlis ntuj nqeg
Anonim
Tap Tap Rainbow - 2 Player Quick Reaction Game
Tap Tap Rainbow - 2 Player Quick Reaction Game
Tap Tap Rainbow - 2 Player Quick Reaction Game
Tap Tap Rainbow - 2 Player Quick Reaction Game
Tap Tap Rainbow - 2 Player Quick Reaction Game
Tap Tap Rainbow - 2 Player Quick Reaction Game

Cov hlua LED tsuas yog siv 3 xov hlau. Yog li kuv tsuas xav tau 5V lub zog (liab), hauv av (dawb) thiab teeb liab (ntsuab). Yog tias koj tseem siv Espruino nco ntsoov xyuas cov lus qhia hauv lawv lub vev xaib. Ib qho rau RGB LEDs tau piav qhia meej heev.

Kuv tau txiav cov hlua LED ua 3 ntu ntawm 6 LEDs thiab tom qab ntawd txuas nrog cov ua ke nrog cov xov hlau ntxiv. Txoj hauv kev no, txhua lub LEDs yog siv tib qho kab uas txuag kuv 2 qhov chaw nres nkoj ntxiv ntawm lub rooj tsavxwm thiab nws yooj yim dua rau txoj haujlwm.

Txuas cov nyees khawm tau nyuaj me ntsis. Kuv xav siv qhov chaw nres nkoj tsawg dua li ua tau ntawm lub rooj tsav xwm yog li kuv tau xav txog kev teeb tsa I2C tab sis ua tsis tau zoo heev ntawm nws. Kuv tsis tuaj yeem ua nws li ntawd kuv tau saib xyuas lwm yam.

Thaum kawg kuv pom cov lus qhia ntawm Espruino rau Keypad uas yog xaim li Keypad Matrix nrog 16 nyees khawm. Qhov no zoo li yooj yim rau siv, yog li kuv tau mus rau qhov ntawd. Kuv tsuas xav tau 12 lub pob kom kuv xav tau daim duab 3x4.

Hauv lub keypad matrix txhua lub nyees khawm tau txuas rau kab thiab kab. Txoj kev no koj tsuas xav tau 8 qhov chaw nres nkoj rau 16 khawm. Hauv kuv teeb kuv tsuas xav tau 2 zaug 6 nyees khawm thiaj li yog tag nrho ntawm 7 chaw nres nkoj ntawm lub rooj tsavxwm (4 kab nrog 3 kab). Nws tseem yog qhov tsawg dua txuas nrog 12 khawm sib cais thiab Keypad module ntawm Espruino yog qhov yooj yim heev rau siv.

Kuv pom cov lus qhia zoo txog cov keypad ntawm cov hauv paus hauv Circuit Court uas tau pab kuv ntau nrog cov hlua ntawm cov nyees khawm.

Thaum kuv tswj kom txuas tag nrho kuv cov nyees khawm kuv tau ntxhov siab heev vim tias cov khoom txuas txuas tas li ntog tawm thiab nws tau lig. Yog li kuv tau kaw txhua yam ua ke ntawm lub npov thiab tsis nco qab thaij duab. Kuj tsis yog tus neeg siv zoo heev hnub kuv yuav tsum rov txuas xov tooj hauv 1 ntawm lub thawv.

Kauj Ruam 3: Sau Txoj Cai

Sau Txoj Cai
Sau Txoj Cai
Sau Txoj Cai
Sau Txoj Cai
Sau Txoj Cai
Sau Txoj Cai

Espruino tau teeb tsa hauv Javascript yog li rau kuv nws tsis yooj yim dua ces sau cov lej rau Arduino.

Txoj cai tuaj yeem siv qee qhov kev txhim kho tab sis nws ua haujlwm tam sim no. Kuj tseem muaj kab (tej zaum nws yog qhov tshwj xeeb: D) qhov twg koj tsis tuaj yeem nias 2 khawm tib lub sijhawm. Tab sis nws ua rau nws nyuaj me ntsis (nyeem ua rau tsis txaus ntseeg) los ua qhov kev ua si, yog li kuv tseem tsis tau tshawb xyuas qhov teeb meem tseem tsis tau, Kuv zoo li nws zoo li no (yog tias koj xoob nws ua rau muaj kev ntxhov siab ntxiv).

Kev teeb tsa cov LEDs yog yooj yim me ntsis. Txhua LED hauv txoj hlua yog 3 qhov tseem ceeb hauv ib qho array. Yog li yog tias koj muaj cov kab zoo li [255, 0, 0, 255, 0, 0] koj muaj thawj 2 LEDs liab.

Hauv kev nthuav dav sai.

1. Ua ntej kuv txhais kuv cov xim thiab ua kom muaj ntau yam xim

2. Tom qab ntawd kuv txhais cov neeg siv teeb tsa, zoo li khawm IDs thiab ntsuas qhov twg txhua tus neeg uas ua ntawv muaj nyob hauv kab hlua LED

3. Thaum pib qhov kev ua si kuv shuffle tag nrho cov xim nyob rau hauv zaj sawv array thiab khaws cov ntaub ntawv rau hauv ib qho Array tshiab. Tom qab ntawd kuv rov pib dua txhua lub LEDs thiab teeb rau sab saum toj LEDs nrog cov xim zaj sawv sib dhos

4. Thaum kawg peb muaj cov cai uas mloog rau cov xwm txheej tseem ceeb. Kuv khaws txhua qhov kev nkag mus rau hauv ib qho array thiab tshawb xyuas yog tias cov kab no nyob hauv kab lus raug.

5. Ib qho zoo ntxiv kuv ntxiv nag hmo nws tias cov yeej tau txais kev kho nrog zaj duab xis txaus txaus: D

Tseem muaj ntau yam uas kuv muaj hauv siab ua kom lom zem dua tab sis qhov ntawd yog qee yam rau tom qab;)

Kuv tsis muaj peev xwm upload tag nrho qhov chaws yog li kuv tau muab tso rau hauv Gitlab

gitlab.com/marzsman/tap_tap_rainbow

Kauj Ruam 4: Muaj Kev Lom Zem Nrog Nws !!! ?

Image
Image
Muaj Kev Lom Zem Nrog Nws !!! ?
Muaj Kev Lom Zem Nrog Nws !!! ?

Thaum kuv tus ntxhais thiab kuv nyob qhov twg sau nws lub tswv yim thiab xav txog nws yuav tsum saib zoo li cas, Kuv nyiam lub tswv yim ntawd tam sim. Tab sis kuv yuav tsum hais tias, Kuv yeej tsis xav tias nws yuav lom zem ua luaj li. Peb twb muaj qee qhov zaj sawv loj sib ntaus sib tua: D

Kuv vam tias txhua tus yuav muaj kev lom zem ntau nrog nws zoo li peb muaj.

Nws tseem yog thawj qhov haujlwm uas kuv tau ua hauv lub sijhawm luv luv thiab qee yam uas tau ua nrog kuv tus ntxhais 8 xyoo THIAB nws kuj yog thawj qhov kev qhia (kawg!), Yog li hauv txoj kev nws yog qhov haujlwm tshwj xeeb heev rau kuv. Yog li kuv vam tias nws nyiam!

Yog tias koj muaj lus nug lossis lus qhia kuv zoo siab tau hnov lawv!

Pom zoo: