Cov txheej txheem:
- Kauj ruam 1: Cov ntaub ntawv
- Kauj ruam 2: Breadboarding
- Kauj Ruam 3: Coding Arduino
- Kauj Ruam 4: Kev sib haum xeeb
- Kauj Ruam 5: Cov Lus Cim Kawg
Video: Yooj Yim Kev Sib Koom Yooj Yim: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:27
Nqe lus piav qhia
Txoj haujlwm no yog tus tswj hwm yooj yim heev uas tuaj yeem muab tswv yim rau Kev Sib Koom thaum nias cov nyees khawm Kuv tsim nws los tswj cov kev ua si uas kuv tau ua uas cov neeg ua si tuaj yeem mus sab laug thiab sab xis. Tau kawg koj tuaj yeem hloov kho nws rau kev tswj hwm ntau dua. Tsis tas yuav siv lwm lub tsev qiv ntawv ntxiv.
Kauj ruam 1: Cov ntaub ntawv
Cov khoom xav tau
- -Arduino 2x resistor
- -[~ 220 Ohm
- -Cov xov hlau
- -2x Nyees khawm
- -Breadboard
Kauj ruam 2: Breadboarding
Kuv pib los ntawm kev txuas qhov chaw nres nkoj arduino GND mus rau qhov tsis zoo (-) tus pin nyob rau sab laug ntawm lub khob cij, thiab txuas 5V rau qhov zoo (+) ntawm sab xis ntawm lub khob cij.
Tom qab ntawd kuv muab cov nyees khawm tso rau hauv qhov chaw kuv xav tau mto. Thiab txuas lawv siv nrog cov xov hlau thiab cov tiv thaiv.
Kauj Ruam 3: Coding Arduino
Ua ntej tshaj plaws koj yuav tsum tau sau qee cov cai rau koj Arduino kom khiav. Kuv muab cov lus pom hauv cov cai uas piav qhia nws ua dab tsi.
// Tshaj tawm cov pins uas khawm txuas nrog.
const int buttonPin1 = 3; const int buttonPin2 = 4;
void teeb tsa ()
{// Pib qhov Serial.begin (9600); // Kho tus pin raws li tso zis. pinMode (buttonPin1, INPUT); pinMode (buttonPin2, INPUT); }
void lub voj ()
{// Nyeem lub xeev ntawm lub pob yog (digitalRead (buttonPin1) == HIGH) {// luam kab no yog lub xeev HIGH. Serial.println ("Sab laug"); ncua (20); } yog (digitalRead (buttonPin2) == HIGH) {// luam kab no yog tias lub xeev HIGH. Serial.println ("Txoj Cai"); ncua (20); }}
Kauj Ruam 4: Kev sib haum xeeb
Yog tias koj tsis muaj game npaj, txoj cai no yuav ua haujlwm ntawm txhua qhov gameobject hauv kev sib koom.
yog tias qhov no yog qhov koj yuav xav tau gameobject kom txav mus.
Rau qhov yooj yim peb yuav tsim lub voos xwmfab los ntawm kev mus rau GameObject-> 3D Object-> Cube
thaum lub voos xwmfab nyob hauv koj qhov xwm txheej, xaiv nws thiab nias lub pob Ntxiv Cov Khoom, thiab tsim tsab ntawv tshiab.
Tsis tas li koj yuav tsum tau hloov qib Api sib xws nyob rau hauv kev txiav txim rau System. IO. Ports tsev qiv ntawv ua haujlwm.
Txhawm rau ua qhov no mus rau Edit-> Project Settings-> Player
nqes mus rau hauv cov ntawv qhia zaub mov no kom txog thaum koj pom Api Compatibility Level thiab xaiv. NET 2.0 hloov ntawm. Net 2.0 subset
Tam sim no koj tau npaj pib coding.
siv System. Collections; siv System. Collections. Generic; siv UnityEngine; siv System. IO. Ports;
pej xeem hauv chav PlayerMovement: MonoBehaviour
{pej xeem ntab ceev; ntab txav;
SerialPort sp = tshiab SerialPort ("COM3", 9600);
void Pib ()
{// Khiav cov cai qhib qhov chaw nres nkoj txuas OpenSerialPort (); }
tsis muaj dab tsi OpenSerialPort ()
{// Qhib qhov chaw nres nkoj txuas sp. Open (); sp. ReadTimeout = 1; }
tsis muaj dabtsis txav (txoj hlua txoj kev)
{// Txheeb xyuas qhov kev taw qhia qhov arduino tau dhau mus yog (Kev Taw Qhia == "Sab laug") {txav mus = -1; } yog (Kev taw qhia == "Txoj Cai") {txav = 1; } // xam tus nqi uas gameobject yuav raug txav ntab txhais lus = txav * ceev; // Siv qhov txav mus rau gameobject hloov pauv. Txhais lus (txhais lus, 0, 0); }
void hloov tshiab ()
{yog (sp. IsOpen) {sim {// thaum lub serialport qhib qhib ua haujlwm txav lub luag haujlwm thiab hla kab uas Arduino luam ntawv txav chaw (sp. ReadLine ())); } ntes (System. Exception) {
}
}
} }
Kauj Ruam 5: Cov Lus Cim Kawg
Txheeb xyuas yog tias koj cov khoom siv ua haujlwm
Ib qho teeb meem uas kuv tau ntsib thaum tsim qhov no yog txhua qhov xov hlau thiab cov cai raug thiab yuav tsum tsis muaj teeb meem hlo li, tab sis nws tsis ua haujlwm. tib yam tuaj yeem tshwm sim nrog qee yam ntawm koj lwm yam khoom siv.
Pom zoo:
D.I.Y YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM LOS NTAWM SCRAPS: 4 Cov Kauj Ruam (nrog Duab)
D.I.Y YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM LOS NTAWM SCRAPS: Hnub no kuv xav qhia yuav ua li cas kom pom lub teeb pom kev zoo los ntawm lub zog xa hluav taws xob tsis siv hluav taws xob los ntawm tus txhuam txhuam hniav thiab lub tshuab solenoid valve coils uas tau khaws los ntawm scrapyard.Ua ntej pib, thov saib cov vis dis aus hauv qab no:
Cov Txheej Txheem Kicker Yooj Yim thiab Kev Tso Cai Nrog Slack Kev Sib Koom: 12 Cov Kauj Ruam (nrog Duab)
Txoj Cai Kicker Yooj Yim thiab Kev Tso Cai Nrog Slack Kev Sib Koom: Hauv lub tuam txhab uas kuv ua haujlwm muaj lub rooj ncaws pob. Lub tuam txhab nyob ntau cov plag tsev thiab rau qee tus neeg ua haujlwm nws yuav siv sijhawm li 3 feeb los txog ntawm lub rooj thiab … kom paub tias lub rooj twb nyob lawm
Kev Ceeb Toom Hluav Taws Xob Siv Arduino [Hauv Qhov Yooj Yim Yooj Yim Yooj Yim]: 3 Kauj Ruam
Kev Ceeb Toom Hluav Taws Xob Siv Arduino [Hauv Ob Qes Yooj Yim Yooj Yim]: Puas yog koj tab tom nrhiav kom ua txoj haujlwm yooj yim thiab nthuav nrog Arduino uas nyob rau tib lub sijhawm tuaj yeem muaj txiaj ntsig tiag tiag thiab muaj peev xwm cawm txoj sia? tej yam tshiab thiab tshiab. Hauv kab ntawv no peb mus
Txoj Kev Yooj Yim thiab Yooj Yim Los Hloov Koj Lub Xauv Screen hauv 6 Cov Kauj Ruam Yooj Yim (Windows 8-10): 7 Kauj Ruam
Txoj Kev Yooj Yim thiab Yooj Yim Los Hloov Koj Lub Xauv Screen hauv 6 Cov Kauj Ruam Yooj Yim (Windows 8-10): Xav hloov pauv yam ntawm koj lub laptop lossis PC? Xav tau kev hloov pauv hauv koj qhov chaw? Ua raws cov kauj ruam no yooj yim thiab yooj yim kom ua tiav koj tus kheej lub computer ntsuas phoo
YUAV UA LI CAS YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM TSHAJ PLAWS YOOJ YIM: 4 Cov Kauj Ruam
YUAV UA LI CAS YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM TSHAJ PLAWS: Nyob zoo txhua tus hauv cov lus qhia no kuv yuav qhia koj yuav ua li cas kom yooj yim " SOIL DRYNESS SENSOR ". Qhuav ntawm cov av tau txheeb xyuas siv qhov taw qhia coj. Lub teeb ci wi