Cov txheej txheem:

Cov Neeg Siv Yooj Yim Sib Tham Sib Tham rau Kev Qhia thiab Kev Ntsuam Xyuas: 11 Kauj Ruam
Cov Neeg Siv Yooj Yim Sib Tham Sib Tham rau Kev Qhia thiab Kev Ntsuam Xyuas: 11 Kauj Ruam

Video: Cov Neeg Siv Yooj Yim Sib Tham Sib Tham rau Kev Qhia thiab Kev Ntsuam Xyuas: 11 Kauj Ruam

Video: Cov Neeg Siv Yooj Yim Sib Tham Sib Tham rau Kev Qhia thiab Kev Ntsuam Xyuas: 11 Kauj Ruam
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Kaum ib hlis
Anonim
Image
Image

Txoj haujlwm no tau tsim los ua ib feem ntawm chav kawm hauv tsev kawm qib siab, lub hom phiaj yog ua kom muaj kev sib tham sib tham los qhia thiab ntsuas qee yam ncauj lus. Rau nws peb tau siv Kev Ua Haujlwm ntawm PC rau lub interface thiab Arduino NANO rau lub khawm arcade thiab LEDs, yog li nws yooj yim zoo nkauj. Txhais qhia, nws muaj qhov cuam tshuam uas tus qauv tau tshwm sim thiab tus neeg siv tuaj yeem nyem rau hauv txhua qhov khoom kom tau txais cov lus piav qhia ntawm nws. Txawm li cas los xij, txhawm rau tshuaj xyuas tus neeg siv, nws muaj qhov teeb meem zoo li qhov teeb meem, qhov uas tus neeg siv yuav tsum rub thiab poob txhua ntu los tsim tus qauv sib xws, thiab nias lub pob kom paub meej lawv cov lus teb, tom qab ntawd LEDs ntawm lub pob yuav qhia rau tus neeg siv. yog tias cov lus teb yog lossis tsis yog.

Qhov teeb meem tshwm sim feem ntau peb tau khiav mus rau qhov ua txoj haujlwm no yog kev sib txuas lus ntawm Kev Ua thiab Arduino raws li kev nyob qis qis ntawm kev sib txuas tuaj yeem sib txawv ntawm cov khoos phis tawj, cuam tshuam kev txav ntawm lub cuab yeej. Tsis tas li, koj yuav tsum txheeb xyuas qhov chaw nres nkoj uas Arduino txuas txhua lub sijhawm, ua rau txhua lub cuab yeej USB txuas nrog suav yog li koj yuav tsum txheeb xyuas qhov COM nws yog dab tsi.

Kauj ruam 1: Programming Interface on Processing (Setup)

Programming Interface ntawm Kev Ua (Teeb)
Programming Interface ntawm Kev Ua (Teeb)

Peb teeb tsa cov kev hloov pauv uas yuav siv, txoj haujlwm ntawm txhua ntu raws li arrays ntawm x thiab y cordinates, ntxiv rau arrays rau cov duab ntawm txhua ntu rau Teach (imgA) thiab Evaluate (img) menus, kab ntawv los tshuaj xyuas yog tias cov lus teb raug thiab cov kab rau lub zog thiab cov xauv, uas yuav txiav txim siab yog tias tus nas nyob saum daim thiab yog nws tau sim khaws lawv. Tom qab ntawd pib ua ntej rau lawv thiab qhib qhov chaw nres nkoj los ntawm qhov uas lub interface yuav txuas lus nrog Arduino.

Kauj ruam 2: Programming Interface on Processing (Main Menu)

Programming Interface ntawm Kev Ua (Cov Ntawv Qhia Tseem Ceeb)
Programming Interface ntawm Kev Ua (Cov Ntawv Qhia Tseem Ceeb)
Programming Interface ntawm Kev Ua (Cov Ntawv Qhia Tseem Ceeb)
Programming Interface ntawm Kev Ua (Cov Ntawv Qhia Tseem Ceeb)

Ua ntej, cov ntawv qhia zaub mov tseem ceeb nws yuav tso tawm ob lub nyees khawm, thiab thaum ib qho ntawm lawv raug nias, txoj haujlwm yuav raug thauj los ntawm "Qhia" cov ntawv qhia lossis "Txheeb Xyuas" cov ntawv qhia zaub mov.

Yog li thaum tus nas raug nias, thiab siab dua ib qho ntawm cov nyees khawm, nws xa cov haujlwm ntawm txhua ntu uas cov ntawv qhia zaub mov tshiab xav tau thiab thauj lwm cov ntawv qhia zaub mov.

Kauj Ruam 3: Programming Interface ntawm Kev Ua ("Qhia" Cov Ntawv Qhia)

Programming Interface ntawm Kev Ua
Programming Interface ntawm Kev Ua
Programming Interface ntawm Kev Ua
Programming Interface ntawm Kev Ua

Ntawm no, yog tias nas yog ib qho ntawm ntu, nws yuav qhib lub zog sib xws, uas, yog tias tus nas raug nias yuav qhib cov ntawv sib xws thiab yuav tso tawm ntawm lub vijtsam.

Kauj ruam 4: Programming Interface on Processing ("Evaluate" Menu)

Programming Interface ntawm Kev Ua
Programming Interface ntawm Kev Ua
Programming Interface ntawm Kev Ua
Programming Interface ntawm Kev Ua

Nov yog tib yam, nws yuav qhib lub zog, uas, thaum tus nas raug nias yuav qhib lub lockeds tab sis lub sijhawm no tsis txhob siv cov ntawv, nws yuav rub qhov uas tau xaiv. (Qhov no tau ua raws "Drag, Drop, thiab Hover nrog nas." Los ntawm kev ua.js)

Kauj Ruam 5: Thaum Mouse raug nias

Thaum Mouse raug nias
Thaum Mouse raug nias

Raws li tau hais ua ntej, thaum tus nas raug nias thiab lub zog yog "muaj tseeb", nws yuav qhib qhov sib xws.

Kauj Ruam 6: Thaum Mouse Dragged

Thaum tus nas rub
Thaum tus nas rub

Yog tias tus nas tau rub, cov ntawv qhia zaub mov tseeb yog ntsuas cov ntawv qhia zaub mov thiab ib qho ntawm cov xauv yog "muaj tseeb" nws yuav rub qhov sib thooj ib sab nrog tus nas.

Kauj Ruam 7: Thaum Nas Tso Tawm

Thaum Nas Tso Tawm
Thaum Nas Tso Tawm
Thaum Nas Tso Tawm
Thaum Nas Tso Tawm

Yog li yog tias tus nas raug tso tawm thiab tseem nyob rau ntawm "Evaluate" cov ntawv qhia, nws yuav tso ib feem uas tau rub rau ntawm qhov chaw uas koj xav tau los tsim tus qauv yog tias nws nyob ze txaus thiab yuav tshuaj xyuas yog tias koj cov lus teb raug. Tom qab ntawd nws yuav rov pib dua txhua lub xauv thiab cov ntawv rau "cuav".

Kauj Ruam 8: Sib Tham Nrog Arduino

Sib tham nrog Arduino
Sib tham nrog Arduino

Yog li tam sim no yog tias koj nias lub pob ntawm Arduino, nws kuaj xyuas yog tias koj tso txhua qhov raug rau hauv qhov chaw thiab qhia koj yog tias nws yog qhov raug lossis tsis raug, tom qab ntawv xa "1" yog tias nws yog lossis "2" yog tias nws tsis raug Arduino.

Kauj Ruam 9: Teeb tsa Arduino (Scheme)

Teeb tsa Arduino (Scheme)
Teeb tsa Arduino (Scheme)
Teeb tsa Arduino (Scheme)
Teeb tsa Arduino (Scheme)

Qhov no yog Scheme siv rau arduino, tab sis nrog Arcade Button, yog li cov hlau ntsuab mus rau lub pob yuav mus rau hauv qab txuas ntawm lub pob (COM) thiab cov hlau liab yuav mus rau ib nrab (TSIS MUAJ). 220Ω resistor tau siv rau LEDs, 1kΩ rau khawm.

Kauj ruam 10: Programming Arduino

Programming Arduino
Programming Arduino

Tam sim no, nws teeb tsa lub pob raws li INPUT ntawm tus lej digital 2 thiab LEDs raws li OUTPUT ntawm 4, 6 thiab 8. Tom qab ntawd teeb tsa Chaw Nkoj thiab nyeem nws, yog tias nws tau txais "1" (cov lus teb raug) nws yuav pom lub 3 LEDs ib ntawm ib qho, yog tias nws tau txais "2" (cov lus teb tsis raug) nws yuav ci ib qho ntawm lawv xwb. Tsis tas li, yog tias lub pob nyem, nws yuav xa tus "e" mus rau lub interface.

Kauj Ruam 11: Nov Yog Txhua Yam, Muaj Kev Lom Zem

Nov yog cov lej siv rau txoj haujlwm no:

Pom zoo: