Cov txheej txheem:
- Kauj ruam 1: Circuit Court
- Kauj Ruam 2: Hloov Daim Duab Rulette
- Kauj ruam 3: Pib
- Kauj ruam 4: Pib ntawm Khawm Thawb
- Kauj Ruam 5: Txoj Haujlwm
Video: Cov Duab Roulette Nrog Obniz: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:29
Kuv tau ua daim duab roulette. Yog tias koj nias lub pob, tus roulette pib tig. Yog tias koj nias dua, tus roulette nres tig thiab nrov nrov!
Kauj ruam 1: Circuit Court
Peb siv tsuas yog tus hais lus txuas thiab khawm.
Tus lej xov tooj ntawm tus xov tooj tau sau rau ntawm qhov program.
khawm = obniz.wired ("Button", {signal: 6, gnd: 7}); speaker = obniz.wired ("Speaker", {signal: 0, gnd: 1});
Kauj Ruam 2: Hloov Daim Duab Rulette
Hauv HTML, koj tuaj yeem siv "CSS hloov pauv". Piv txwv li, qhov no yog cov cai ntawm cov duab tig 90 degree.
document.getElementById ("roulette"). style = "hloov pauv: tig (90deg);";
Txhawm rau pib thiab nres tig qeeb, ntxiv qhov hloov pauv ceev rau kev hloov qib ntawm ib tus ncej.
cia ceev = 0; tso deg = 0; muaj nuj nqi tig () {deg += ceev; document.getElementById ("roulette"). style = "hloov pauv: tig ("+deg+"deg);"
}
setInterval (tig, 10);
Kauj ruam 3: Pib
Koj puas xav beep ntawm roulette tsis hloov? Nrog rau qhov no, koj tuaj yeem beep ntawm 440Hz 10ms.
hais lus.play (440); tos obniz.wait (10); hais lus.stop ();
Nov yog yuav ua li cas thiaj paub txog kev hloov pauv ntawm roulette no.
yog (Math.floor ((deg + ceev) / (360 / 7.0)) - Math.floor (deg / (360 / 7.0))> = 1) {onRouletteChange (); }
Yog li, qhov no yog txoj cai ntawm tig thiab beep.
cia ceev = 0; tso deg = 0; muaj nuj nqi tig () {// ntawm qhov hloov pauv tus nqi yog (Math.floor ((deg + nrawm) /(360 /7.0)) - Math.floor (deg /(360 /7.0))> = 1) {onRouletteChange (); } deg += ceev; document.getElementById ("roulette"). style = "hloov pauv: tig ("+deg+"deg);"
}
setInterval (tig, 10);
async muaj nuj nqi onRouletteChange () {
yog (! hais lus) {rov qab;} hais lus.play (440); tos obniz.wait (10); hais lus.stop (); }
Kauj ruam 4: Pib ntawm Khawm Thawb
Txhawm rau paub khawm lub xeev, ntxiv cov khawm khawm Lub Xeev thiab teeb tus nqi ntawm lub xeev khawm tam sim no.
button.onchange = muaj nuj nqi (nias) {buttonState = nias; };
Thiab tseem ntxiv var theem rau lub xeev tam sim no ntawm roulette.phase tau teeb tsa ib qho ntawm no.
const PHASE_WAIT_FOR_START = 0; const PHASE_ROTATE = 1; const PHASE_STOPPING = 2; const PHASE_STOPPED = 3;
Piv txwv li, thaum theem PHASE_WAIT_FOR_START thiab koj xav mus rau theem tom ntej.
yog (theem == PHASE_WAIT_FOR_START) {ceev = 0; yog (buttonState) {theem = PHASE_ROTATE; }}
Txhawm rau ua kom cov txheej txheem nrawm dua, hloov pauv nrawm.
yog (theem == PHASE_ROTATE) {nrawm = nrawm+0.5; }
Txhawm rau txo txoj cai, hloov pauv nrawm.
:
yog (theem == PHASE_STOPPING) {nrawm = nrawm-0.2; }
Cov no yog ib feem ntawm roulette. Cia peb ua!
Kauj Ruam 5: Txoj Haujlwm
Thov saib ntawm no rau txoj haujlwm
Pom zoo:
Hloov-Hloov Cov Khoom Ua Si: Cov Khoom Ua Si Cov Khoom Ua Si Ua Tau Zoo!: 7 Cov Kauj Ruam (nrog Duab)
Hloov-Hloov Cov Khoom Ua Si: Cov Khoom Siv Hluav Taws Xob Ua Tau Zoo!: Qho khoom ua si hloov pauv qhib txoj hauv kev tshiab thiab kev daws teeb meem kom tso cai rau menyuam yaus uas muaj lub cev muaj peev xwm txwv lossis kev xiam oos qhab kev loj hlob los cuam tshuam nrog cov khoom ua si ntawm nws tus kheej. Hauv ntau qhov xwm txheej, cov menyuam yaus uas xav tau cov khoom ua si hloov pauv tsis tuaj yeem nkag mus
Cov Duab Duab Duab thiab Cov Duab 1: 4 Cov Kauj Ruam (nrog Duab)
Cov Duab Duab Cubes thiab Cov Duab 1: Thaum sim nrog qee cov ntoo ntoo thiab cov duab los qhia, kuv pom ob peb txoj hauv kev los ua cov voos thiab lwm yam duab los ntawm cov khoom siv yooj yim. Los ntawm kev muab cov no los ua Cov Ntawv Qhia, Kuv vam tias yuav txhawb nqa kev ua si thiab kev kawm. Kev hloov pauv ntawm qhov kev qhia no
Yuav Ua Li Cas Thiaj Li Tshem Tawm Lub Computer Nrog Cov Kauj Ruam Yooj Yim thiab Duab: 13 Kauj Ruam (nrog Duab)
Yuav Tsum Tshem Tawm Lub Khoos Phis Tawj Li Cas Nrog Cov Kauj Ruam Yooj Yim thiab Duab: Nov yog cov lus qhia txog yuav ua li cas tshem lub PC. Feem ntau ntawm cov khoom siv yooj yim yog hloov pauv thiab tshem tawm tau yooj yim. Txawm li cas los xij nws yog ib qho tseem ceeb uas koj tau koom nrog nws. Qhov no yuav pab tiv thaiv koj kom tsis txhob poob ib feem, thiab tseem ua rau kev rov ua dua tshiab
Cov Duab Duab Duab Duab, WiFi Txuas - Raspberry Pi: 4 Cov Kauj Ruam (nrog Duab)
Cov Duab Duab Duab Duab, WiFi Txuas - Raspberry Pi: Nov yog txoj hauv kev yooj yim heev thiab tus nqi qis mus rau cov duab thav duab digital - nrog qhov zoo ntawm kev ntxiv /tshem cov duab hla WiFi ntawm 'nyem thiab luag' siv (pub dawb) xa cov ntaub ntawv . Nws tuaj yeem siv tau los ntawm qhov me me £ 4.50 Pi Zero. Koj tseem tuaj yeem hloov pauv
Rov Qab Siv Cov Duab Duab Nrog Virtual Asistent: 7 Cov Kauj Ruam (nrog Duab)
Rov Qab Siv Cov Duab Duab Nrog Virtual Asistent: Nyob zoo txhua tus! Cov lus qhia no tau yug los ntawm lub laptop faib ua ib nrab, yuav los ntawm ib tus phooj ywg. Thawj qhov kev sim ntawm txoj haujlwm no yog kuv Lego Digital Photo Frame, txawm li cas los xij, yog ib tus neeg mob siab rau Siri thiab Google Tam sim no, Kuv txiav txim siab coj nws mus rau qhov tshiab