Cov txheej txheem:
- Kauj Ruam 1: Hom Sib Txawv ntawm Arduinos
- Kauj Ruam 2: Arduino Uno Nta
- Kauj Ruam 3: Arduino IDE
- Kauj ruam 4: Plug rau hauv
- Kauj ruam 5: Chaw
- Kauj Ruam 6: Khiav Sketch
- Kauj ruam 7: Serial Monitor
- Kauj Ruam 8: Digital In
- Kauj Ruam 9: Analog Hauv
- Kauj ruam 10: Digital Out
- Kauj ruam 11: Analog Out
- Kauj Ruam 12: Sau Koj Tus Kheej
- Kauj Ruam 13: Cov ntaub thaiv npog
- Kauj Ruam 14: Tsim Lub Tsev Sab Nraud
- Kauj ruam 15: Mus Ntxiv
Video: Intro rau Arduino: 15 Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Arduino yog lub hauv paus qhib kev tswj hwm microcontroller board. Hauv cov lus Askiv yooj yim, koj tuaj yeem siv Arduino los nyeem cov cim thiab tswj hwm yam xws li lub cav thiab teeb. Qhov no tso cai rau koj rub cov program mus rau lub rooj tsavxwm no uas tom qab ntawd tuaj yeem cuam tshuam nrog yam hauv ntiaj teb tiag. Nrog rau qhov no, koj tuaj yeem ua cov cuab yeej uas teb thiab ua rau lub ntiaj teb loj.
Piv txwv li, koj tuaj yeem nyeem lub ntsuas cua noo txuas nrog lub lauj kaub cog thiab qhib lub kaw lus tsis siv dej yog tias nws qhuav dhau lawm. Lossis, koj tuaj yeem ua tus neeg rau zaub mov sib tham nyob ib leeg uas tau ntsaws rau hauv koj li internet router. Lossis, koj tuaj yeem muaj nws tweet txhua zaus koj tus miv hla lub qhov rooj tsiaj. Lossis, koj tuaj yeem muaj nws pib lub lauj kaub kas fes thaum koj lub tswb nrov tawm thaum sawv ntxov.
Yeej, yog tias muaj qee yam uas nyob hauv txhua txoj kev tswj hwm hluav taws xob, Arduino tuaj yeem cuam tshuam nrog nws hauv qee yam. Thiab txawm hais tias nws tsis raug tswj los ntawm hluav taws xob, koj tseem tuaj yeem siv cov khoom uas yog (zoo li lub cav thiab lub tshuab hluav taws xob), los cuam tshuam nrog nws.
Qhov ua tau ntawm Arduino yuav luag tsis muaj qhov txwv. Xws li, tsis muaj txoj hauv kev uas ib qho kev qhia ib leeg tuaj yeem npog txhua yam koj yuav xav paub. Qhov ntawd tau hais tias, Kuv tau ua tiav qhov zoo tshaj plaws los muab cov ntsiab lus tseem ceeb ntawm cov txuj ci tseem ceeb thiab kev paub uas koj xav tau kom tau txais koj li Arduino thiab ua haujlwm. Yog tias tsis muaj dab tsi ntxiv, qhov no yuav tsum ua haujlwm ua lub hauv paus rau kev sim thiab kawm ntxiv.
Kauj Ruam 1: Hom Sib Txawv ntawm Arduinos
Muaj ntau hom sib txawv ntawm Arduinos xaiv los ntawm. Nov yog cov lus piav qhia luv luv ntawm qee hom ntau ntawm Arduino cov laug cam koj tuaj yeem ntsib. Rau tag nrho cov npe ntawm tam sim no txhawb nqa Arduino cov laug cam, txheeb xyuas Arduino kho vajtse nplooj ntawv.
Arduino Ib
Qhov feem ntau ntawm Arduino yog Arduino Uno. Pawg no yog yam uas neeg feem coob tham txog thaum lawv hais txog Arduino. Hauv qib tom ntej, muaj qhov ua tiav ntau dua ntawm nws cov yam ntxwv.
Arduino NG, Diecimila, thiab Duemilanove (Legacy Versions)
Cov ntawv qub ntawm Arduino Uno cov khoom lag luam suav nrog NG, Diecimila, thiab Duemilanove. Qhov tseem ceeb kom nco txog cov laug cam yog tias lawv tsis muaj qhov tshwj xeeb ntawm Arduino Uno. Qee qhov sib txawv tseem ceeb:
- Diecimila thiab NG siv ATMEGA168 chips (tsis zoo li ATMEGA328 muaj zog dua),
- Ob lub Diecimila thiab NG muaj lub jumper nyob ib sab ntawm USB chaw nres nkoj thiab xav tau phau ntawv xaiv los ntawm USB lossis roj teeb lub zog.
- Arduino NG xav kom koj tuav lub pob khawm so ntawm ob peb lub vib nas this ua ntej rub tawm cov program.
Arduino Mega 2560
Arduino Mega 2560 yog qhov thib ob uas tau ntsib ntau tshaj ntawm tsev neeg Arduino. Arduino Mega zoo li Arduino Uno tus kwv tij laus dua. Nws khav 256 KB ntawm lub cim xeeb (8 zaug ntau dua li Uno). Nws kuj tseem muaj 54 tus lej nkag thiab tso tawm, 16 ntawm qhov uas yog tus pin analog, thiab 14 ntawm qhov uas tuaj yeem ua PWM. Txawm li cas los xij, txhua qhov ntxiv ua haujlwm tau los ntawm tus nqi ntawm lub rooj tsav xwm loj me ntsis. Nws yuav ua rau koj txoj haujlwm muaj zog dua, tab sis nws tseem yuav ua rau koj txoj haujlwm loj dua. Txheeb xyuas cov nom Arduino Mega 2560 nplooj ntawv kom paub meej ntxiv.
Arduino Mega ADK
Qhov tshwj xeeb ntawm Arduino no yog ib qho Arduino Mega uas tau tsim tshwj xeeb rau kev cuam tshuam nrog Android smartphones. Qhov no ib yam nkaus tam sim no yog ib qho qub txeeg qub teg.
Arduino Yus
Arduino Yun siv lub ATMega32U4 nti hloov ntawm ATmega328. Txawm li cas los xij, dab tsi tiag tiag teeb nws sib nrug yog qhov ntxiv ntawm Atheros AR9331 microprocessor. Cov ntawv ntxiv no tso cai rau pawg tswj hwm no los ua haujlwm Linux ntxiv rau qhov ua haujlwm qub Arduino. Yog tias txhua yam ntawd tsis txaus, nws tseem muaj peev xwm nkag tau rau hauv wifi. Hauv lwm lo lus, koj tuaj yeem teeb tsa pawg thawj coj los ua cov khoom zoo li koj xav nrog lwm Arduino, tab sis koj tseem tuaj yeem nkag mus rau Linux sab ntawm pawg thawj coj los txuas rau internet ntawm wifi. Arduino-sab thiab Linux-sab tuaj yeem yooj yim sib txuas lus rov qab los nrog txhua lwm yam. Qhov no ua rau pawg thawj coj saib no muaj zog heev thiab muaj ntau yam. Kuv nyuam qhuav khawb qhov saum npoo ntawm qhov koj tuaj yeem ua nrog qhov no, tab sis kom kawm paub ntau ntxiv, txheeb xyuas nplooj ntawv ua haujlwm Arduino Yun.
Arduino Nano Cov
Yog tias koj xav mus me dua li tus qauv Arduino board, Arduino Nano yog rau koj! Raws li qhov saum npoo ATmega328 nti, qhov version ntawm Arduino no tau nqes mus rau qhov hneev taw me me uas muaj peev xwm haum rau hauv qhov chaw nruj. Nws kuj tseem tuaj yeem tso ncaj qha rau hauv lub khob cij, ua kom yooj yim rau daim ntawv nrog.
Arduino LilyPad
LilyPad tau tsim los rau kev hnav thiab e-textile daim ntawv thov. Nws yog npaj los xaws rau ntaub thiab txuas nrog rau lwm yam khoom siv xaws tau siv xov xov. Pawg thawj coj no xav kom siv tshwj xeeb FTDI-USB TTL cov phiaj xwm txuas xov tooj. Yog xav paub ntxiv, nplooj ntawv Arduino LilyPad yog qhov pib tsim nyog.
(Nco ntsoov tias qee qhov txuas ntawm nplooj ntawv no yog cov koom nrog sib txuas. Qhov no tsis hloov pauv tus nqi ntawm yam khoom rau koj. Kuv rov nqis peev nyiaj dab tsi uas kuv tau txais los ua cov haujlwm tshiab. Yog tias koj xav tau cov lus qhia rau lwm tus neeg xa khoom, thov qhia rau kuv paub.)
Kauj Ruam 2: Arduino Uno Nta
Qee tus neeg xav txog tag nrho Arduino pawg thawj coj los ua tus tswj hwm microcontroller, tab sis qhov no tsis raug. Arduino pawg thawj coj tau yog tshwj xeeb tsim los tsim lub rooj tsav xwm rau kev ua haujlwm thiab tsim qauv nrog Atmel microcontrollers.
Qhov zoo tshaj plaws ntawm Arduino pawg thawj coj yog tias nws pheej yig dua, ntsaws ncaj qha rau hauv lub khoos phis tawj USB chaw nres nkoj, thiab nws yog qhov tuag-yooj yim rau teeb tsa thiab siv (piv rau lwm cov laug cam txhim kho).
Qee qhov tseem ceeb ntawm Arduino Uno suav nrog:
- Tsim qhov qhib qhov chaw. Qhov zoo ntawm nws tau qhib qhov yog tias nws muaj zej zog coob ntawm cov neeg siv thiab teeb meem nws. Qhov no ua rau nws yooj yim mus nrhiav ib tus neeg los pab koj debug koj cov haujlwm.
- Ib qho yooj yim USB interface. Cov nti ntawm lub rooj tsav xwm ntsaws ncaj qha rau hauv koj lub USB chaw nres nkoj thiab sau npe hauv koj lub khoos phis tawj ua lub chaw nres nkoj virtual. Qhov no tso cai rau koj los cuam tshuam nrog nws zoo li dhau los nws yog cov khoom siv. Cov txiaj ntsig ntawm kev teeb tsa no yog kev sib txuas lus txuas yog ib qho yooj yim heev (thiab kuaj lub sijhawm) raws tu qauv, thiab USB ua txuas nws mus rau cov khoos phis tawj niaj hnub no yooj yim heev.
- Kev tswj fais fab yooj yim heev thiab kev teeb tsa hluav taws xob built-in. Koj tuaj yeem txuas lub zog sab nraud txog li 12v thiab nws yuav tswj hwm nws mus rau 5v thiab 3.3v. Nws kuj tseem tuaj yeem siv ncaj qha tawm ntawm USB chaw nres nkoj yam tsis muaj lub zog sab nraud.
- Ib qho yooj yim-rau-nrhiav, thiab av pheej yig, microcontroller "lub hlwb." ATmega328 nti muag rau txog $ 2.88 ntawm Digikey. Nws muaj ntau tus lej ntawm cov cuab yeej zoo xws li timers, PWM pins, sab nrauv thiab sab hauv cuam tshuam, thiab ntau hom kev pw tsaug zog. Txheeb xyuas cov ntaub ntawv raug cai kom paub meej ntxiv.
- Ib lub moos 16mhz. Qhov no ua rau nws tsis yog lub microcontroller nrawm tshaj, tab sis nrawm txaus rau feem ntau daim ntawv thov.
- 32 KB ntawm flash nco rau khaws koj cov cai.
- 13 tus pin digital thiab 6 tus lej analog. Cov pins no tso cai rau koj txuas cov cuab yeej sab nraud rau koj Arduino. Cov pins no yog qhov tseem ceeb rau txuas ntxiv kev suav lub peev xwm ntawm Arduino mus rau hauv lub ntiaj teb tiag. Cias ntsaws koj cov cuab yeej thiab cov ntsuas hluav taws xob rau hauv lub qhov (socket) uas sib haum rau txhua tus pins no thiab koj zoo mus.
- Ib qho ICSP txuas rau hla qhov chaw nres nkoj USB thiab cuam tshuam Arduino ncaj qha raws li cov khoom siv. Qhov chaw nres nkoj no yog qhov tsim nyog yuav rov pib dua koj lub nti yog tias nws ua tsis ncaj thiab tsis tuaj yeem tham nrog koj lub computer ntxiv lawm.
- Ib qho ntawm lub nkoj LED txuas rau tus lej digital 13 kom nrawm nrawm yooj yim debug ntawm cov cai.
- Thiab kawg, tab sis tsis tsawg kawg, khawm kom rov pib dua txoj haujlwm ntawm lub nti.
Txog qhov ua tiav tag nrho ntawm Arduino Uno tau muab, nco ntsoov txheeb xyuas nplooj ntawv Arduino raug cai.
Kauj Ruam 3: Arduino IDE
Ua ntej koj tuaj yeem pib ua dab tsi nrog Arduino, koj yuav tsum rub tawm thiab teeb tsa Arduino IDE (kev txhim kho ib puag ncig ib puag ncig). Txij ntawm no mus peb yuav xa mus rau Arduino IDE ua Arduino Programmer.
Arduino Programmer yog ua raws Tus Txheej Txheem IDE thiab siv kev hloov pauv ntawm C thiab C ++ cov lus programming.
Koj tuaj yeem pom qhov hloov tshiab kawg ntawm Arduino Programmer ntawm nplooj ntawv no.
Kauj ruam 4: Plug rau hauv
Txuas Arduino rau koj lub computer USB chaw nres nkoj.
Thov nco ntsoov tias txawm hais tias Arduino ntsaws rau hauv koj lub computer, nws tsis yog qhov tseeb USB ntaus ntawv. Lub Rooj Tswjhwm Saib muaj cov nti tshwj xeeb uas tso cai rau nws pom hauv koj lub khoos phis tawj ua qhov chaw nres nkoj virtual thaum nws txuas rau hauv USB chaw nres nkoj. Qhov no yog vim li cas nws thiaj tseem ceeb rau ntsaws lub rooj tsavxwm. Thaum lub rooj tsav tsheb tsis ntsaws, qhov chaw nres nkoj virtual uas Arduino ua haujlwm raws li yuav tsis muaj tam sim no (txij li tag nrho cov ntaub ntawv hais txog nws nyob ntawm Arduino board).
Nws kuj tseem zoo kom paub tias txhua tus Arduino muaj qhov tshwj xeeb virtual chaw nyob chaw nres nkoj. Qhov no txhais tau tias txhua lub sijhawm koj txuas rau lwm lub Arduino board rau hauv koj lub khoos phis tawj, koj yuav tsum rov teeb tsa lub chaw nres nkoj uas tau siv.
Arduino Uno xav tau tus txiv neej USB A rau txiv neej USB B cable.
Kauj ruam 5: Chaw
Ua ntej koj tuaj yeem pib ua dab tsi hauv Arduino programmer, koj yuav tsum teeb tsa pawg thawj coj saib thiab chaw nres nkoj.
Txhawm rau teeb tsa lub rooj tsavxwm, mus rau cov hauv qab no:
Cov Cuab Yeej Cuab Yeej
Xaiv qhov version ntawm board uas koj siv. Txij li thaum kuv muaj Arduino Uno ntsaws rau hauv, Kuv pom tseeb xaiv "Arduino Uno."
Txhawm rau teeb tsa qhov chaw nres nkoj, mus rau cov hauv qab no:
Cov Cuab Yeej Serial Port
Xaiv qhov chaw nres nkoj uas zoo li:
/dev/tty.usbmodem [cov lej zauv]
Kauj Ruam 6: Khiav Sketch
Arduino cov program hu ua sketches. Arduino programmer los nrog ib tuj ntawm cov piv txwv sketches preloaded. Qhov no zoo heev vim tias txawm tias koj tsis tau tsim ib yam dab tsi hauv koj lub neej, koj tuaj yeem thauj ib qho ntawm cov duab kos no thiab tau txais Arduino los ua qee yam.
Txhawm rau kom tau LED khi rau tus lej digital 13 kom ntsais thiab tua, cia li ntsaws qhov piv txwv ntsais.
Qhov piv txwv ntsais muag tuaj yeem pom ntawm no:
Cov Piv Txwv Cov Ntaub Ntawv Pib ntsais muag
Qhov piv txwv ntsais muag pib teev tus pin D13 ua qhov tso tawm thiab tom qab ntawd ntsais qhov ntsuas LED ntawm Arduino board rau thiab tawm txhua ob.
Thaum qhov piv txwv ntsais muag qhib, nws tuaj yeem teeb tsa mus rau ATMEGA328 nti los ntawm nias lub pob upload, uas zoo li tus xub taw tes rau sab xis.
Daim ntawv ceeb toom tias qhov chaw teeb tsa sab saum toj LED txuas nrog tus pin 13 ntawm Arduino yuav pib ntsais muag. Koj tuaj yeem hloov tus nqi ntawm kev ntsais muag los ntawm kev hloov qhov ntev ntawm qhov ncua thiab nias lub pob upload dua.
Kauj ruam 7: Serial Monitor
Tus lej saib xyuas tso cai rau koj lub khoos phis tawj txuas nrog ntu nrog Arduino. Qhov no tseem ceeb vim tias nws siv cov ntaub ntawv uas koj Arduino tau txais los ntawm cov ntsuas thiab lwm yam khoom siv thiab qhia nws hauv lub sijhawm tiag tiag ntawm koj lub computer. Muaj lub peev xwm no muaj nuj nqis rau kev debug koj cov cai thiab nkag siab tias tus lej tus lej zoo li cas tiag tiag tau txais.
Piv txwv li, txuas qhov chaw cheb (tus pin nruab nrab) ntawm lub hwj chim rau A0, thiab cov pins sab nraud, ntsig txog, mus rau 5v thiab hauv av. Tom ntej upload daim duab qhia hauv qab no:
Piv Txwv Cov Ntaub Ntawv 1. Basics AnalogReadSerial
Nyem lub pob kom koom nrog cov saib uas zoo li lub iav tsom iav. Tam sim no koj tuaj yeem pom cov lej raug nyeem los ntawm tus lej sib piv hauv tus lej saib. Thaum koj tig lub pob qhov rooj tus lej yuav nce thiab nqis.
Cov lej yuav nyob nruab nrab ntawm 0 thiab 1023. Qhov laj thawj rau qhov no yog tias tus pin piv tau hloov pauv qhov hluav taws xob ntawm 0 thiab 5V rau tus lej tsis raug.
Kauj Ruam 8: Digital In
Arduino muaj ob hom sib txawv ntawm cov pins, uas yog analog thiab digital.
Txhawm rau pib nrog, cia saib cov koob yees duab digital.
Cov lej nkag digital tsuas yog muaj ob lub xeev ua tau, uas nyob hauv lossis tawm. Ob lub xeev nyob thiab tawm no tseem raug hu ua:
- HIGH lossis LOW
- 1lub 0
- 5 v sau 0v.
Cov tswv yim no feem ntau siv los nkag siab tias muaj qhov hluav taws xob thaum lub qhib qhib lossis kaw.
Cov tswv yim digital kuj tseem tuaj yeem siv ua lub hauv paus rau suav tsis txheeb cov txheej txheem kev sib txuas lus digital. Los ntawm kev tsim 5V (HIGH) mem tes lossis 0V (LOW) mem tes, koj tuaj yeem tsim lub cim binary, lub hauv paus ntawm txhua qhov kev suav. Qhov no muaj txiaj ntsig zoo rau tham nrog digital sensors zoo li PING ultrasonic sensor, lossis sib txuas lus nrog lwm cov khoom siv.
Rau qhov piv txwv yooj yim ntawm kev siv digital, txuas qhov hloov pauv ntawm tus lej digital 2 mus rau 5V, 10K resistor ** los ntawm tus lej digital 2 rau hauv av, thiab ua raws cov cai hauv qab no:
Piv Txwv Cov Ntaub Ntawv 2. Digital Button
** Lub 10K tus tiv thaiv raug hu ua rub tawm tus neeg tawm tsam vim nws txuas cov lej digital rau hauv av thaum qhov hloov pauv tsis raug nias. Thaum qhov hloov pauv raug nias, qhov sib txuas hluav taws xob hauv qhov hloov pauv muaj qhov tsis kam ntau dua li tus tiv thaiv, thiab hluav taws xob tsis txuas rau hauv av. Hloov chaw, hluav taws xob ntws ntawm 5V thiab tus lej digital. Qhov no yog vim tias hluav taws xob ib txwm xaiv txoj hauv kev uas tsis muaj kev tiv thaiv. Txhawm rau kawm paub ntau ntxiv txog qhov no, mus ntsib Digital Pins nplooj ntawv.
Kauj Ruam 9: Analog Hauv
Ib cag los ntawm cov lej nkag digital, Arduino tseem khav tus lej ntawm cov tswv yim sib txuas.
Cov tswv yim analog siv tus lej sib piv thiab ua 10-ntsis analog-rau-digital (ADC) hloov pauv kom tig nws mus rau tus lej ntawm 0 thiab 1023 (4.9mV cov kauj ruam).
Hom kev tawm tswv yim no yog qhov zoo rau kev nyeem cov ntawv tiv taus. Cov no yog cov cim ntsuas uas muab kev tiv thaiv rau hauv Circuit Court. Lawv kuj tseem zoo rau nyeem qhov sib txawv ntawm qhov teeb liab ntawm 0 thiab 5V. Qhov no muaj txiaj ntsig zoo thaum cuam tshuam nrog ntau hom kev sib txuas sib piv.
Yog tias koj ua raws li tus piv txwv hauv Kauj Ruam 7 rau kev koom tes nrog tus saib xyuas, koj twb tau sim siv tus lej nkag sib piv.
Kauj ruam 10: Digital Out
Tus pin tawm digital tuaj yeem teeb tsa kom siab (5v) lossis LOW (0v). Qhov no tso cai rau koj qhib yam thiab tua yam.
Ib cag los ntawm kev tig yam khoom rau thiab tawm (thiab ua LEDs ntsais muag), daim ntawv tso tawm no yooj yim rau ntau daim ntawv thov.
Qhov tseem ceeb tshaj plaws, nws tso cai rau koj sib tham digitally. Los ntawm kev tig tus pin rau thiab tawm sai, koj tab tom tsim cov xeev binary (0 thiab 1), uas tau lees paub los ntawm suav tsis txheeb lwm yam khoom siv hluav taws xob ua lub cim binary. Los ntawm kev siv txoj hauv kev no, koj tuaj yeem sib txuas lus siv ntau tus txheej txheem sib txawv.
Kev sib txuas lus digital yog lub ncauj lus tseem ceeb, tab sis kom tau txais lub tswv yim dav dav ntawm yam uas tuaj yeem ua tau, txheeb xyuas nplooj ntawv cuam tshuam nrog kho vajtse.
Yog tias koj ua raws li tus piv txwv hauv Kauj Ruam 6 kom tau txais LED kom ntsais muag, koj twb tau sim siv tus pin tso tawm digital.
Kauj ruam 11: Analog Out
Raws li tau hais ua ntej, Arduino muaj tus lej ua haujlwm tshwj xeeb. Ib qho ntawm cov haujlwm tshwj xeeb no yog kev ntsuas dav dav ntawm mem tes, uas yog txoj hauv kev Arduino muaj peev xwm los tsim cov khoom zoo sib xws.
Pulse dav tes taws los piav - lossis PWM rau luv - ua haujlwm sai tig lub PWM tus pin siab (5V) thiab qis (0V) los simulate cov teeb liab analog. Piv txwv li, yog tias koj yuav ntsais ib qho LED qhib thiab tawm nrawm txaus (kwv yees li tsib milliseconds txhua), nws yuav zoo li nruab nrab qhov ci ci thiab tsuas yog pom tias tau txais ib nrab ntawm lub zog. Hloov pauv, yog tias nws yuav ntsais rau 1 millisecond thiab tom qab ntsais muag rau 9 millisecond, LED yuav zoo li 1/10 li ci thiab tsuas yog tau txais 1/10 qhov hluav taws xob.
PWM yog qhov tseem ceeb rau ntau daim ntawv thov suav nrog ua suab, tswj lub teeb ci, thiab tswj kev nrawm ntawm lub cav.
Rau kev piav qhia ntxaws ntxiv, txheeb xyuas cov lus zais ntawm PWM nplooj ntawv.
Txhawm rau sim PWM koj tus kheej, txuas lub LED thiab 220 ohm resistor rau tus pin 9, hauv kab rau hauv av. Khiav cov piv txwv hauv qab no:
Piv Txwv Cov Ntaub Ntawv 3. Analog Fading
Kauj Ruam 12: Sau Koj Tus Kheej
Txhawm rau sau koj tus lej, koj yuav tsum tau kawm qee yam lus yooj yim programming lus. Hauv lwm lo lus, koj yuav tsum kawm paub tsim kom raug tus lej rau tus programmer kom nkag siab nws. Koj tuaj yeem xav txog qhov zoo li kev nkag siab cov qauv sau ntawv thiab cov cim cim cim. Koj tuaj yeem sau tag nrho phau ntawv yam tsis muaj cov qauv sau ntawv thiab sau kab lus raug, tab sis tsis muaj leej twg yuav nkag siab nkag siab nws, txawm tias nws yog lus Askiv.
Qee yam tseem ceeb yuav tsum nco ntsoov thaum sau koj tus lej:
Ib qho program Arduino hu ua kos duab
Txhua tus lej hauv Arduino kos duab tau ua tiav los ntawm saum toj mus rau hauv qab
Arduino sketches feem ntau tawg ua tsib ntu
- Cov duab kos feem ntau pib nrog lub taub hau uas piav qhia tias daim duab kos ua dab tsi, thiab leej twg sau nws.
- Ntxiv mus, nws feem ntau txhais cov kev hloov pauv thoob ntiaj teb. Feem ntau, qhov no yog qhov uas cov npe tsis tu ncua tau muab rau txawv Arduino pins.
- Tom qab qhov pib hloov pauv tau teeb tsa, Arduino pib teeb tsa niaj hnub. Hauv kev teeb tsa ua haujlwm, peb teeb tsa thawj qhov xwm txheej ntawm qhov hloov pauv thaum tsim nyog, thiab khiav ib qho lej ua ntej uas peb tsuas xav khiav ib zaug. Nov yog qhov pib kev sib tham hauv xov tooj cua, uas yuav tsum tau ua kom muaj lub luag haujlwm saib xyuas.
- Los ntawm kev teeb tsa muaj nuj nqi, peb mus rau lub voj txheej txheem. Qhov no yog lub luag haujlwm tseem ceeb ntawm daim duab. Qhov no tsis yog tsuas yog qhov uas koj cov cai tseem ceeb mus, tab sis nws yuav ua tiav thiab dhau mus, tsuav daim duab kos tseem ua haujlwm.
- Hauv qab lub voj txheej txheem, feem ntau muaj lwm cov haujlwm teev tseg. Cov haujlwm no yog tus neeg siv txhais thiab tsuas yog qhib thaum hu ua teeb tsa thiab ua haujlwm ib ntus. Thaum cov haujlwm no raug hu, Arduino txheej txheem tag nrho cov cai hauv kev ua haujlwm los ntawm sab saum toj mus rau hauv qab thiab tom qab ntawd rov qab mus rau kab tom ntej hauv daim duab kos qhov uas nws tawm thaum lub luag haujlwm tau hu. Cov haujlwm muaj txiaj ntsig zoo vim tias lawv tso cai rau koj los ua cov txheej txheem niaj hnub ua - dhau mus thiab dhau - tsis tas yuav tsum sau kab ib yam ntawm cov lej ntau thiab ntau dua. Koj tuaj yeem yooj yim hu rau kev ua haujlwm ntau zaus, thiab qhov no yuav pub dawb nco ntawm lub nti vim tias txoj haujlwm niaj hnub tsuas yog sau ib zaug. Nws kuj ua rau cov lej nyeem tau yooj yim dua. Txhawm rau kawm paub yuav tsim koj tus kheej li cas, mus saib nplooj ntawv no.
Txhua yam uas tau hais, tsuas yog ob feem ntawm daim duab kos uas yuav tsum tau ua yog teeb tsa thiab Loop cov txheej txheem
Txoj cai yuav tsum tau sau ua lus Arduino, uas yog siv raws li C
Yuav luag txhua nqe lus sau ua lus Arduino yuav tsum xaus nrog;
Cov xwm txheej (xws li yog cov nqe lus thiab rau loops) tsis xav tau ib qho;
Cov xwm txheej muaj lawv tus kheej cov cai thiab tuaj yeem pom nyob hauv "Tswj Cov Qauv" ntawm Arduino Language page
Variables yog qhov chaw khaws cov lej. Koj tuaj yeem hla qhov tseem ceeb rau hauv thiab tawm ntawm qhov sib txawv. Cov ntawv sib txawv yuav tsum tau piav qhia (teev nyob hauv txoj cai) ua ntej lawv tuaj yeem siv tau thiab xav tau hom ntaub ntawv cuam tshuam nrog nws. Txhawm rau kawm qee yam ntawm cov ntaub ntawv yooj yim, tshuaj xyuas Nplooj Ntawv
Okay! Yog li cia peb hais tias peb xav sau cov cai uas nyeem lub photocell txuas nrog tus pin A0, thiab siv qhov nyeem peb tau txais los ntawm lub photocell los tswj qhov ci ci ntawm LED txuas nrog tus pin D9.
Ua ntej, peb xav qhib BareMinimum kos duab, uas tuaj yeem pom ntawm:
Piv Txwv Cov Ntaub Ntawv 1. Basic BareMinimum
BareMinimum Sketch yuav tsum zoo li no:
void teeb tsa () {
// muab koj cov cai teeb tsa ntawm no, kom khiav ib zaug:} void loop () {// muab koj tus lej tseem ceeb ntawm no, kom rov ua dua:} Tom ntej no, cia tso lub taub hau ntawm cov cai, yog li lwm tus neeg paub txog yam peb tab tom ua, vim li cas, thiab raws li cov ntsiab lus dab tsi
/*
LED Dimmer los ntawm Genius Arduino Programmer 2012 Tswj lub teeb ci ntawm LED ntawm tus pin D9 raws li kev nyeem ntawv ntawm lub photocell ntawm tus pin A0 Tus lej no nyob hauv Public Domain */ void setup () {// muab koj teeb tsa teeb ntawm no, kom khiav ib zaug:} void loop () {// muab koj tus lej tseem ceeb ntawm no, kom rov ua dua:} Thaum uas yog txhua qhov sib nrug deb, cia peb txhais lub npe tus pin, thiab tsim kom muaj qhov sib txawv
/*
LED Dimmer los ntawm Genius Arduino Programmer 2012 Tswj lub teeb ci ntawm LED ntawm tus pin D9 raws li kev nyeem ntawv ntawm lub photocell ntawm tus pin A0 Tus lej no yog nyob hauv Public Domain */ // name analog pin 0 ib lub npe tas li const int analogInPin = A0; // name digital pin 9 ib lub npe tsis tu ncua const int LEDPin = 9; // sib txawv rau kev nyeem ntawv photocell int photocell; tsis muaj teeb tsa teeb tsa () {// muab koj cov cai teeb tsa ntawm no, kom khiav ib zaug:} tsis muaj dab tsi voj () {// muab koj cov cai tseem ceeb ntawm no, kom rov ua dua:} Tam sim no cov ntawv hloov pauv thiab tus lej npe tau teeb tsa, cia peb sau qhov tseeb code
/*
LED Dimmer los ntawm Genius Arduino Programmer 2012 Tswj lub teeb ci ntawm LED ntawm tus pin D9 raws li kev nyeem ntawv ntawm lub photocell ntawm tus pin A0 Tus lej no yog nyob hauv Public Domain */ // name analog pin 0 ib lub npe tas li const int analogInPin = A0; // name digital pin 9 ib lub npe tsis tu ncua const int LEDPin = 9; // sib txawv rau kev nyeem ntawv photocell int photocell; void teeb () {// tsis muaj dab tsi ntawm no tam sim no} void loop () {// nyeem cov analog hauv tus pin thiab teeb tsa kev nyeem ntawv rau lub photocell sib txawv photocell = analogRead (analogInPin); // tswj tus pin LED siv tus nqi nyeem los ntawm photocell analogWrite (LEDPin, photocell); // ncua txoj cai rau 1/10 thib ob // 1 thib ob = 1000 ncua (100); } Yog tias peb xav pom tus lej tus lej tus lej sib piv tau nyeem los ntawm lub photocell, peb yuav tsum tau siv lub ntsuas saib. Cia peb qhib qhov chaw nres nkoj thiab tso cov lej ntawd
/*
LED Dimmer los ntawm Genius Arduino Programmer 2012 Tswj lub teeb ci ntawm LED ntawm tus pin D9 raws li kev nyeem ntawv ntawm lub photocell ntawm tus pin A0 Tus lej no nyob hauv Public Domain */ // name analog pin 0 ib lub npe tas li const int analogInPin = A0; // name digital pin 9 ib lub npe tsis tu ncua const int LEDPin = 9; // sib txawv rau kev nyeem ntawv photocell int photocell; teeb tsa tsis muaj dab tsi () {Serial.begin (9600); } void loop () {// nyeem cov analog hauv tus pin thiab teeb tsa kev nyeem ntawv mus rau photocell sib txawv photocell = analogRead (analogInPin); // luam tus nqi photocell rau hauv tus saib xyuas Serial.print ("Photocell ="); Serial.println (photocell); // tswj tus pin LED siv tus nqi nyeem los ntawm photocell analogWrite (LEDPin, photocell); // ncua txoj cai rau 1/10 thib ob // 1 thib ob = 1000 ncua (100); }Yog xav paub ntau ntxiv txog kev tsim cov cai, mus saib hauv Foundations Page. Yog tias koj xav tau kev pab nrog Arduino Language, tom qab ntawd Cov Lus Nplooj Ntawv yog qhov chaw rau koj.
Tsis tas li, Tus Piv Txwv Sketch Nplooj ntawv yog qhov chaw zoo rau pib cuam tshuam nrog cov cai. Tsis txhob ntshai hloov tej yam thiab sim ua.
Kauj Ruam 13: Cov ntaub thaiv npog
Cov ntaub thaiv npog yog nthuav dav apdapter cov laug cam uas ntsaws rau saum Arduino Uno thiab muab nws cov haujlwm tshwj xeeb.
Txij li Arduino tau qhib kho vajtse, txhua tus neeg uas muaj lub siab nyiam ua dawb los ua Arduino ntaub thaiv npog rau txhua txoj haujlwm uas lawv xav ua kom tiav. Raws li qhov no, muaj ntau tus lej ntawm Arduino daim thaiv tawm hauv cov tsiaj qus. Koj tuaj yeem pom cov npe loj hlob zuj zus ntawm Arduino daim thaiv hauv Arduino chaw ua si. Nco ntsoov tias yuav muaj ntaub thaiv npog ntau dua li koj yuav pom hauv cov npe ntawm nplooj ntawv ntawd (ib txwm, Google yog koj tus phooj ywg).
Txhawm rau muab koj qhov kev nkag siab me me ntawm kev muaj peev xwm ntawm Arduino shields, txheeb xyuas cov ntawv qhia no yuav siv li cas peb daim ntawv tso cai Arduino:
- Wireless SD Shield
- Ethernet ntaub thaiv npog
- Lub Cev Tsav Tsheb
Kauj Ruam 14: Tsim Lub Tsev Sab Nraud
Raws li koj cov phiaj xwm tau yooj yim dua, koj yuav xav tsim koj tus kheej Circuit Court los cuam tshuam nrog Arduino. Thaum koj yuav tsis kawm hluav taws xob ib hmos, internet yog qhov tsis txaus ntseeg rau kev paub hluav taws xob thiab daim duab kos duab.
Txhawm rau pib nrog cov khoom siv hluav taws xob, mus ntsib Basic Basic Instructable Instructable.
Kauj ruam 15: Mus Ntxiv
Txij ntawm no, tsuas yog sab laug ua yog ua qee qhov haujlwm. Muaj suav tsis txheeb txaus txaus Arduino cov peev txheej thiab qhia hauv online.
Nco ntsoov txheeb xyuas Nplooj Ntawv Official Arduino thiab Rooj Sib Tham. Cov ntaub ntawv teev tseg ntawm no tsis muaj nuj nqis thiab ua tiav. Qhov no yog cov peev txheej zoo rau kev ua haujlwm debugging.
Yog tias koj xav tau kev tshoov siab rau qee qhov kev lom zem pib ua haujlwm, txheeb xyuas 20 Qhov Tsis Txaus Ntseeg Arduino Projects qhia.
Rau cov npe loj lossis Arduino project, Arduino Channel yog qhov chaw zoo pib.
Qhov ntawd yog nws. Koj nyob ntawm koj tus kheej.
Hmoov zoo thiab zoo siab hacking!
Koj puas pom qhov no muaj txiaj ntsig, lom zem, lossis lom zem? Ua raws @madeineuphoria kom pom kuv cov phiaj xwm tshiab kawg.
Pom zoo:
Covid Kev Nyab Xeeb Kev Nyab Xeeb Ntu 1: Intro rau Tinkercad Circuits !: 20 Cov Kauj Ruam (nrog Duab)
Covid Kev Nyab Xeeb Kev Nyab Xeeb Ntu 1: Intro rau Tinkercad Circuits!: Nyob zoo, phooj ywg! Hauv ob ntu ntu no, peb yuav kawm paub siv Tinkercad Cov Kev Siv Hluav Taws Xob - lom zem, muaj zog, thiab cov cuab yeej siv rau kev kawm paub txog kev ua haujlwm li cas! Ib txoj hauv kev zoo tshaj los kawm, yog ua. Yog li, peb yuav xub tsim peb tus kheej txoj haujlwm: th
Dynamic LED Teeb Pom Duab Duab Lub thawv thiab Ncej rau Kos Duab :: 16 Cov Kauj Ruam (nrog Duab)
Dynamic LED Lighting Shadow Box and Frame for Art :: Teeb pom kev yog qhov tseem ceeb ntawm kev kos duab. Thiab yog tias teeb pom kev zoo tuaj yeem hloov pauv nrog lub sijhawm nws tuaj yeem dhau los ua qhov tseem ceeb ntawm kev kos duab. Txoj haujlwm no tau pib nrog koom nrog kev ua yeeb yam pom thiab pom tias lub teeb pom kev zoo tuaj yeem hloov pauv li cas
Txaus Siab Rau Koj Tus Kheej Tsuas Yog Siv 12V-rau-AC-kab Inverter rau LED Lub Teeb Hluav Taws Xob Tsis txhob Rov Ua Rau Lawv rau 12V.: 3 Cov Kauj Ruam
Txaus Siab Rau Koj Tus Kheej Tsuas Yog Siv 12V-rau-AC-kab Inverter rau LED Lub Teeb Hluav Taws Xob Tsis txhob Rewiring Lawv rau 12V: Kuv txoj kev npaj tau yooj yim. Kuv xav txiav cov phab ntsa uas siv hluav taws xob LED teeb ua ib daim ces rov txuas nws kom khiav tawm 12 volts. Lwm txoj hauv kev yog siv lub zog hloov pauv, tab sis peb txhua tus paub tias lawv tsis muaj txiaj ntsig zoo, puas yog? Txoj cai? Los yog lawv?
Dell Laptop Rau Hauv Duab Duab Duab: 9 Kauj Ruam (nrog Duab)
Dell Laptop Rau Hauv Duab Duab Duab: Cov no yog cov kauj ruam uas kuv tau siv los tsim kuv Cov Duab Duab Duab los ntawm Dell 1150 lub laptop qub. EDIT: ua tsaug rau qhov tshwj xeeb
Ntxiv Pc Sync Jack rau Nikon Sc-28 Ttl Cable (siv Auto Settings rau lub Koob Yees Duab Flash thiab Ua Rau Lub Koob Yees Duab Tawm !!): 4 Kauj Ruam
Ntxiv Pc Sync Jack rau Nikon Sc-28 Ttl Cable (siv Auto Settings rau ntawm Lub Koob Yees Duab Flash thiab Ua Rau Lub Koob Yees Duab Tawm Tsam !!): Hauv cov lus qhia no kuv yuav qhia koj yuav tshem tawm ib qho ntawm cov khoom ntiag tug 3pin TTL txuas txuas ntawm ib sab ntawm Nikon SC-28 tawm lub koob yees duab TTL cable thiab hloov nws nrog tus qauv PC txuas txuas. qhov no yuav tso cai rau koj siv lub siab nyem, s