Cov txheej txheem:

Tsheb kauj vab Simulator Nrog Kev Hloov Sijhawm Ceev: 5 Kauj Ruam
Tsheb kauj vab Simulator Nrog Kev Hloov Sijhawm Ceev: 5 Kauj Ruam

Video: Tsheb kauj vab Simulator Nrog Kev Hloov Sijhawm Ceev: 5 Kauj Ruam

Video: Tsheb kauj vab Simulator Nrog Kev Hloov Sijhawm Ceev: 5 Kauj Ruam
Video: Dais thiab nab qa sib xeem tsheb kauj vab 2024, Kaum ib hlis
Anonim
Tsheb kauj vab Simulator Nrog Kev Hloov Kho Lub Sijhawm Tiag
Tsheb kauj vab Simulator Nrog Kev Hloov Kho Lub Sijhawm Tiag

Txoj haujlwm no siv lub tshuab nqus hlau sib nqus los tsim lub ntsuas cua nrawm thiab tswj cov vis dis aus nrawm ntawm thawj tus neeg caij tsheb kauj vab yeeb yaj kiab hauv YouTube lossis lwm yam xov xwm. Arduino suav mph thiab tom qab ntawd siv cov ntaub ntawv ntawd los sim ua lub computer khawm nias. Lub pob nyem no, ua ke nrog Google Chrome txuas ntxiv, ua kom nrawm dua lossis qeeb cov vis dis aus raws li kev hloov pauv nrawm. Nws muaj cov txheej txheem kho vajtse yooj yim uas cov uas tau pib rau Arduino tuaj yeem tsim tau yooj yim ntawm lawv tus kheej.

Tus lej ntsuas qhov nrawm yog ua raws txoj haujlwm no:

Cov Khoom Kho Mob:

1. Arduino Leonardo

2. Micro USB Cable (Yuav tsum muaj peev xwm xa cov ntaub ntawv thiab <3ft)

3. Sib Nqus Reed Hloov

4.10k Ohm Resistor

5. 22 Ntsuas Hlau (<4ft)

6. Soldering Hlau

7. Cov laug

8. Daim Kab Xev Hluav Taws Xob

9. Zip Ties

10. Tsheb kauj vab nyob ruaj ruaj

11. Tsheb kauj vab

Kauj ruam 1: Rub cov software uas cuam tshuam rau koj lub khoos phis tawj

1. Arduino IDE

2. Tus Saib Xyuas Yees Duab Ceev (Web Browser Extension)

a Google Chrome

b. Firefox

Kauj ruam 2: Kho vajtse

Kho vajtse
Kho vajtse
Kho vajtse
Kho vajtse
Kho vajtse
Kho vajtse

Txhua qhov kev sib txuas yuav tsum tau muab sib dhos ua ke thiab kaw nrog kab xev hluav taws xob. Arduino tuaj yeem ntsia tau rau hauv lub tsheb kauj vab uas siv cov ntaub yas nrog rau Arduino (txuas hauv cov npe ntu saum toj no). Qhov no tseem ceeb vim tias yog lub tsheb kauj vab hlau nyob hauv kev sib cuag ncaj qha nrog tus pin, nws tuaj yeem tsim kev sib txuas tsis xav tau. Cov ntaub ntawv tseem muaj qhov uas ua rau zip-khi rooj plaub rau lub tsheb kauj vab yooj yim. 22 lub xaim hlau yuav tsum tau qhwv raws tus ncej ntawm lub tsheb kauj vab thiab ruaj ntseg nrog daim kab xev lossis zip txuas. Nco ntsoov kom tsis txhob qhwv cov hlau nyob txhua qhov chaw uas nws tuaj yeem raug ntes ntawm cov txheej txheem txav.

Kauj Ruam 3: Muab Tsheb kauj vab tso rau ntawm Lub Caij Tsheb Caij Tsheb

Ruaj lub tsheb kauj vab mus rau hauv lub tsheb kauj vab nyob ruaj ruaj thiab xyuas kom nws ze txaus rau koj lub khoos phis tawj rau lub micro-USB qaum kom ncav cuag koj lub khoos phis tawj. Tsis tas li, nco ntsoov saib qhov nrug rau koj yog qhov tsim nyog tuaj yeem yooj yim pom lub vijtsam. Cov lus qhia yuav ua li cas kom ruaj ntseg tso koj lub tsheb kauj vab ntawm lub rooj muag khoom tuaj yeem pom ntawm no.

Kauj Ruam 4: Upload thiab Xeem Arduino Code

Upload thiab Xeem Arduino Code
Upload thiab Xeem Arduino Code

Yog tias koj tshiab rau Arduino IDE, nplooj ntawv taw qhia tuaj yeem pom ntawm no. Nws yog ib qho tseem ceeb kom nco ntsoov Leonardo xav tau micro-USC cable txhawm rau rub tawm uas muaj peev xwm xa cov ntaub ntawv. Ntau lub micro-USB cables tsuas yog siv rau kev them nyiaj xwb thiab cov ntawd yuav tsis ua haujlwm. Thaum Arduino Leonardo tau lees paub los ntawm lub khoos phis tawj, luam tawm thiab muab luam thiab tso cov cai hauv qab no:

// Txoj cai no pom lub tsheb kauj vab nrawm thiab hloov qhov ntawd mus rau lub computer keyboard nias

// xam

// lub vojvoog ntawm lub log ~ 13.5 nti // ib puag ncig = pi*2*r = ~ 85 ntiv tes // max nrawm 35mph = ~ 616inches/thib ob // max rps = ~ 7.25

#suav nrog

#define reed A0 // tus pin txuas nrog nyeem hloov

// storage variables

koj reedVal; lub sijhawm ntev; // sijhawm nruab nrab ntawm ib qho kev sib hloov tag nrho (hauv ms) ntab mph; ntab vojvoog = 13.5; // log vojvoog (hauv nti) ntab ncig; ntab vprevious; tus nqi ntab;

int maxReedCounter = 100; // sijhawm me me (hauv ms) ntawm ib qho kev sib hloov (rau debouncing)

koj reedCounter;

void teeb tsa () {

reedCounter = maxReedCounter; puag ncig = 2*3.14*radius; pinMode (reed, INPUT); Keyboard.begin (); // TIMER SETUP- timer cuam tshuam tso cai ntsuas lub sijhawm ntsuas ntawm qhov hloov pauv reed // kom paub ntau ntxiv txog kev teeb tsa ntawm arduino timers saib https://arduino.cc/playground/Code/Timer1 cli (); // nres cuam tshuam

// teeb tsa timer1 cuam tshuam ntawm 1kHz

TCCR1A = 0; // teeb tsa tag nrho TCCR1A rau 0 TCCR1B = 0; // tib yam rau TCCR1B TCNT1 = 0; // teem sijhawm suav rau 1khz nce OCR1A = 1999; // = (1/1000)/((1/(16*10^6))*8) - 1 // qhib CTC hom TCCR1B | = (1 < <WGM12); // Teeb CS11 me ntsis rau 8 prescaler TCCR1B | = (1 << CS11); // pab kom lub sijhawm sib piv cuam tshuam TIMSK1 | = (1 << OCIE1A); sei (); // tso cai cuam tshuam // Kawg TIMER SETUP Serial.begin (9600); }

ISR (TIMER1_COMPA_vect) {// cuam tshuam ntawm qhov sib txawv ntawm 1kHz los ntsuas qhov hloov pauv

reedVal = digitalRead (reed); // tau txais txiaj ntsig ntawm A0 yog tias (reedVal) {// yog tias qhov hloov pauv reed raug kaw yog tias (reedCounter == 0) {// min lub sijhawm nruab nrab ntawm cov noob tau dhau vprevious = mph; ncua (500); mph = (56.8*ntab (ncig))/ntab (timer); // xam mais ib teev timer = 0; // rov teem sijhawm timer reedCounter = maxReedCounter; // reset reedCounter} ntxiv {yog (reedCounter> 0) {// tsis txhob tso reedCounter mus rau qhov tsis zoo reedCounter -= 1; // txo qis reedCounter}}} lwm qhov {// yog tias reed hloov tau qhib yog (reedCounter> 0) {// tsis txhob cia reedCounter mus tsis zoo reedCounter -= 1;/ /txo qis reedCounter}} yog (timer> 2000) {mph = 0; // yog tias tsis muaj qhov hloov pauv tshiab los ntawm reed hloov- log tsheb tseem nyob, teeb mph rau 0 vprevious = 0; } lwm {timer += 1; // timer nce ntxiv}}

void controlComp () {

yog (vprevious mph) // Slow Video Video Speed {Keyboard.press ('s'); Keyboard.releaseAll (); ncua (750); } yog (vprevious == mph) // tsis ua dab tsi {; }} void loop () {// print mph ob zaug thib ob Serial.print ("VPrevious:"); Serial.print ("\ t"); Serial.println (vprevious);

Serial.print ("MPH:");

Serial.print ("\ t"); Serial.println (mph); tswjComp (); }

Thaum cov cai tau ua tiav xa tawm, qhib qhov saib. Tsis muaj kev txav ntawm lub log tsheb tom qab, "MPH" thiab "VPrevious" yuav tsum nyeem 0.00. Tig lub log kom nws nrawm rau ob peb lub kiv puag ncig thiab tom qab ntawd qeeb. Tus saib xyuas yuav tsum nyeem qhov nrawm thiab hom d's rau kev nrawm thiab s rau kev ua kom qeeb. Yog tias tsis muaj qhov txiaj ntsig tshwm sim thaum lub log tig, lub hlau nplaum yuav tsis raug kuaj pom los ntawm tus pas nrig. Xyuas kom cov hlau nplaum muaj zog txaus los ntawm kev mloog rau kev txiav tawm * clink * suab nrov thaum cov hlau nplaum hla qhov hloov.

Kauj Ruam 5: Teeb YouTube Tus Tswj

Teeb YouTube Tswj
Teeb YouTube Tswj

Kauj ruam kawg yog nqa YouTube cov vis dis aus uas koj xav siv los ua raws koj lub tsheb kauj vab. Lub tswv yim yog kom muaj thawj tus neeg cov yeeb yaj kiab uas koj tuaj yeem ua rau koj tus kheej nkag siab thiab txaus siab rau qhov pom thaum caij tsheb kauj vab. Kuv tau ua raws YouTube cov npe ntawm ntau yam kev xaiv video. Lawv suav los ntawm tus lej ntawm cov channel uas tso cov vis dis aus uas haum rau tus neeg thawj tus qauv no. Lawv tseem yog cov vis dis aus zoo li ya los ntawm huab thiab hla kev tsheb ciav hlau hla tebchaws rau qee qhov kev lom zem thawj tus neeg.

Pom zoo: