Cov txheej txheem:

Taw qhia rau Arduino: 18 Kauj Ruam
Taw qhia rau Arduino: 18 Kauj Ruam

Video: Taw qhia rau Arduino: 18 Kauj Ruam

Video: Taw qhia rau Arduino: 18 Kauj Ruam
Video: Qhia hau khaub poob thiab ua khaub poob kua ntses 8/19/2020 2024, Hlis ntuj nqeg
Anonim
Taw qhia rau Arduino
Taw qhia rau Arduino

Koj puas tau xav tsis thoob los ua koj tus kheej cov cuab yeej xws li chaw nres tsheb huab cua, tsheb dashboard rau saib xyuas roj, nrawm thiab qhov chaw taug qab lossis tswj koj cov cuab yeej siv hauv tsev tswj los ntawm cov xov tooj lossis koj puas tau xav txog kev ua cov neeg hlau zoo uas tuaj yeem tham, taug kev thiab txav nws txhais caj npab lossis dab tsi txog kev ua koj tus kheej mp3 player cov cuab yeej, ua kom pom ntiv tes ntsuas, Lub tshuab cog dej tsis siv neeg, ntsuas av qeeg, walkie talkie lossis chaw taws teeb tswj lub koob yees duab CCTV raws kev saib xyuas. Yog tias koj tau xav tsis thoob thiab koj txaus siab tso koj txoj kev koom tes hauv digitizing ntiaj teb ces ntseeg tias koj tuaj yeem ua txhua yam khoom uas koj xav tsim thiab tom qab ntawd koj yuav tsum tau paub qee yam khoom siv hluav taws xob yooj yim thiab txog microcontrollers. Lub microcontroller yog ib qho kev sib txuam tsim hluav taws xob tsim uas siv cov tswv yim los ntawm cov ntsuas sib txawv xws li ntsuas qhov ntsuas kub, ntsuas pom lub teeb pom kev zoo, ntsuas pom qhov ntsuas hluav taws xob, thiab lwm yam. kev kawm hauv ntiaj teb, nkag siab, thiab ua cov cuab yeej no tsis yog txoj haujlwm nyuaj nrog kev koom tes zoo ntawm Arduino zej zog rau ntiaj teb nws tuaj yeem siv tau rau txhua tus nyiam ua haujlwm thiab kws tshaj lij thoob ntiaj teb.

Arduino yog qhov qhib-qhov khoom siv kho vajtse thiab software platform rau hobbyist thiab cov kws tsim khoom los nyeem cov tswv yim los ntawm cov ntsuas sib txawv, txheej txheem cov tswv yim thiab muab lub siab xav los ntawm kev ua haujlwm sib txawv actuators piv txwv li hauv paus koj tuaj yeem hais tau tias Arduino tuaj yeem yog lub hlwb ntawm ntau txoj haujlwm.

Kauj Ruam 1: Hom Arduino

Muaj ntau hom sib txawv ntawm Arduino cov laug cam nrog muaj cov lej sib txawv ntawm analog, digital thiab PWM tus pin thiab qhov zoo tshaj plaws yog koj tuaj yeem pib ua haujlwm yooj yim nrog ib ntawm lawv. Txawv txawv Arduino ntxiv tau sau npe ntawm no.

● Arduino Uno

● Arduino Due

● Arduino Mega

● Arduino Leonardo Pawg Thawj Coj

● Lillypad Arduino Board

Kauj ruam 2: Arduino Uno

Arduino Ib
Arduino Ib

Feem ntau ntawm cov pib pib siv Arduino Uno, nws nyob hauv nkoj uas muaj lub microcontroller tseem ceeb ATMegga328 muaj lub cim xeeb ntawm 2KB SRAM THIAB 32KB nyem nws muaj 14 Digital I/0 uas 6 yog PWM thiab 6 yog cov pins tso tawm. khawm rov pib dua, lub hwj chim txuas, USB txuas thiab ntau ntxiv. Nws suav nrog txhua yam xav tau los tuav lub microcontroller; yooj yim txuas nws mus rau PC nrog kev pab ntawm USB cable thiab muab cov khoom siv kom pib nrog AC-rau-DC adapter lossis roj teeb.

Kauj ruam 3: Arduino Due

Arduino Dhau
Arduino Dhau

Arduino Due lub ntsiab microcontroller yog AT91SAM38XE muaj lub cim xeeb ntawm 96KB SRAM, 512KB flash suav nrog 54 tus lej digital uas 12 yog PWM thiab muaj 16 tus lej sib piv

Kauj Ruam 4: Arduino Mega

Arduino Mega Cov
Arduino Mega Cov

Nws muaj ATmea2560 ua microcontroller muaj cim xeeb ntawm 8KB

SRAM thiab 256KB flash muaj 54 digital IO pins uas 12 yog PWM thiab 16 analog input pins, khawm rov pib dua, lub hwj chim txuas, USB txuas thiab khawm rov pib dua. Nws suav nrog txhua yam xav tau los tuav lub microcontroller; yooj yim txuas nws mus rau PC nrog kev pab ntawm USB cable thiab muab cov khoom siv kom pib nrog AC-rau-DC adapter lossis roj teeb. Tus lej loj ntawm tus pin ua rau pawg Arduino no muaj txiaj ntsig zoo rau kev tsim cov phiaj xwm uas xav tau ib pawg ntawm cov tswv yim digital lossis cov txiaj ntsig zoo li ntau cov nyees khawm.

Kauj Ruam 5: Arduino Leonardo

Arduino Leonardo
Arduino Leonardo

Nws lub microcontroller tseem ceeb yog ATmega32u4 muaj cim xeeb ntawm 2.5KB SRAM thiab 32KB flash muaj 20 digital IO pins thiab 12 analog input pins. Thawj lub rooj tsav xwm txhim kho ntawm Arduino yog pawg thawj coj Leonardo. Pawg thawj coj no siv ib lub microcontroller nrog rau USB. Qhov ntawd txhais tau tias, nws tuaj yeem yooj yim heev thiab pheej yig. Vim tias pawg thawj coj no tswj hwm USB ncaj qha, cov tsev qiv ntawv tuaj yeem tau txais uas tso cai rau Arduino pawg thawj coj ua raws cov keyboard ntawm lub computer, nas, thiab lwm yam.

Kauj Ruam 6: LilyPad Arduino Board

LilyPad Arduino Board
LilyPad Arduino Board

Lily Pad Arduino lub rooj tsavxwm yog siv tau thev naus laus zis thev naus laus zis Txhua lub rooj tsavxwm tau xav txog kev tsim qauv nrog cov ntaub qhwv loj loj & rov qab du kom cia lawv xaws rau hauv khaub ncaws siv xov xov. Qhov Arduino no tseem suav nrog I/O, lub zog, thiab tseem muaj cov laug cam uas tau tsim tshwj xeeb rau e-textiles. Cov no tseem tuaj yeem ntxuav tau!

Kauj Ruam 7: Cov cuab yeej rau Arduino Kev Txhim Kho Ib puag ncig

Cov cuab yeej rau Arduino Kev Txhim Kho Ib puag ncig
Cov cuab yeej rau Arduino Kev Txhim Kho Ib puag ncig

Arduino Programming Language:

Arduino yog programmed hauv C ++ uas tau siv rau hauv ntau qhov sib txawv ntawm cov haujlwm xws li kev txhim kho software tab sis rau Arduino C ++ tau siv nrog kev ua haujlwm ntxiv. Koj tuaj yeem tsim Arduino kos duab, Arduino kos duab yog lub npe muab rau Arduino code file. Koj sau cov cai hauv Arduino IDE. Cov duab kos no tuaj yeem khaws tseg rau hauv cov phiaj xwm phiaj xwm thiab IDE muab qhov kev xaiv los suav ua C ++ code rau hauv tshuab lus thiab xa lawv mus rau hauv Arduino board.

Arduino IDE Cov

Arduino IDE (Kev Txhim Kho Ib Leeg Ib puag ncig) yog C ++ txoj cai kho, ua ke thiab tso cov cuab yeej uas koj tuaj yeem sau koj cov program rau program IO pins rau ntau lub hom phiaj thiab koj tuaj yeem siv qhib-qhib cov tsev qiv ntawv rau kev sau cov haujlwm ntse nrog rau kev ua haujlwm sib txawv peb yuav tom qab sib tham kom ntxaws txog cov tsev qiv ntawv.

Kauj Ruam 8: Kev Txhim Kho Arduino IDE

Arduino IDE Kev Txhim Kho
Arduino IDE Kev Txhim Kho

Kauj Ruam 1. Rub tawm Arduino IDE

Kauj ruam 2. Tos kom txog thaum txheej txheem rub tawm tiav.

Kauj Ruam 3. Nruab qhov software thiab xaiv cov khoom uas koj xav teeb tsa, nrog rau qhov chaw teeb tsa.

Kauj Ruam 4. Txais kev teeb tsa tus tsav tsheb thaum hais kom ua Windows 10

Kauj Ruam 9: Txhim Kho Arduino Driver

Txhim kho Arduino Driver
Txhim kho Arduino Driver
Txhim kho Arduino Driver
Txhim kho Arduino Driver

Mus rau Start-> ntaus Tus Thawj Tswj Ntaus Ntawv>> ob npaug nias thawj qhov tshwm sim los tso Tus Thawj Tswj Ntaus Ntawv.

1. Mus rau Ports> nrhiav Arduino UNO chaw nres nkoj

2. Yog tias koj tsis tuaj yeem pom qhov chaw nres nkoj ntawd, mus rau Lwm Cov Khoom thiab nrhiav Cov Ntaus Tsis Paub

3. Xaiv qhov Arduino UNO chaw nres nkoj> nyem rau ntawm Update Driver.

4. Xaiv qhov kev xaiv 'Xauj kuv lub computer rau Driver software'> mus rau Arduino software rub tawm qhov chaw> xaiv cov ntaub ntawv arduino.inf/Arduino UNO.inf (nyob ntawm koj li software version)

5. Tos kom txog thaum Windows ua tiav cov txheej txheem teeb tsa tsav tsheb.

Tam sim no koj tau teeb tsa Arduino software thiab tsav tsheb hauv koj lub computer, nws yog lub sijhawm qhib koj thawj daim duab. Xaiv koj lub hom phiaj board thiab chaw nres nkoj thiab rub tawm qhov program kom paub tseeb tias koj lub rooj tsav xwm tau nce thiab khiav.

Kauj Ruam 10: Cov Duab Sawv Cev ntawm Arduino IDE

Kev Ua Phem Ntawm Arduino IDE
Kev Ua Phem Ntawm Arduino IDE

Raws li Arduino IDE tau siv los kho, txuag, suav thiab tso cov lej rau hauv Arduino ntawm no yog cov duab sawv cev ntawm Arduino IDE.

Kauj Ruam 11: Txhawm Qhib Cov Ntaub Ntawv Tshiab hauv Arduino IDE

Txhawm rau Qhib Cov Ntaub Ntawv Tshiab hauv Arduino IDE
Txhawm rau Qhib Cov Ntaub Ntawv Tshiab hauv Arduino IDE

Txhawm rau qhib cov ntawv tshiab nyem rau ntawm file-> tshiab

Kauj Ruam 12: Kom Txuag Arduino Sketch

Txhawm rau Txuag Arduino Sketch
Txhawm rau Txuag Arduino Sketch
Txhawm rau Txuag Arduino Sketch
Txhawm rau Txuag Arduino Sketch
Txhawm rau Txuag Arduino Sketch
Txhawm rau Txuag Arduino Sketch

Cov ntaub ntawv tshiab yuav qhib

Kauj ruam-1: Txhawm rau txuag Arduino Sketch mus rau File-> save Ib lub qhov rais kom txuag tau cov duab kos yuav tshwm tuaj

Kauj Ruam-2: Hloov npe Arduino Sketch thiab nyem khawm tseg. Daim duab yuav raug cawm.

Kauj Ruam 13: Piv Txwv Txoj Haujlwm Arduino

Piv txwv ntawm Arduino Program
Piv txwv ntawm Arduino Program
Piv txwv ntawm Arduino Program
Piv txwv ntawm Arduino Program

Arduino IDE suav nrog ntau qhov piv txwv txoj haujlwm kom kawm thiab ua cov phiaj xwm los ntawm lawv cov piv txwv no hais txog ntsais ib qho coj, analog thiab digital input tawm, kev sib txuas lus txuas, sensor, thiab lwm yam.

Txhawm rau qhib coj blink piv txwv txoj haujlwm nyem rau ntawm File-> Piv txwv-> Yooj Yim-> Blink

Kauj Ruam 14: Tsev Kawm Ntawv Arduino

Tsev Kawm Ntawv Arduino
Tsev Kawm Ntawv Arduino
Tsev Kawm Ntawv Arduino
Tsev Kawm Ntawv Arduino
Tsev Kawm Ntawv Arduino
Tsev Kawm Ntawv Arduino

Raws li Arduino zej zog "Cov tsev qiv ntawv yog sau cov cai uas ua rau nws yooj yim rau koj los txuas rau lub ntsuas pa, tso saib, hloov pauv, thiab lwm yam. Muaj ntau pua lub tsev qiv ntawv ntxiv muaj nyob hauv Is Taws Nem rau rub tawm ". Cov tsev qiv ntawv suav nrog cov txheej txheem ib txwm muaj thiab ua haujlwm xws li cov cuab yeej tsav tsheb lossis cov haujlwm siv hluav taws xob siv cov tsev qiv ntawv nws dhau los ua qhov haujlwm yooj yim yam tsis muaj coding ntau kab uas koj tuaj yeem siv ua ntej ua haujlwm rau koj qhov program. Muaj ntau yam qhib cov tsev qiv ntawv muaj nyob hauv is taws nem, Arduino IDE tseem muab cov tsev qiv ntawv uas tau tsim los ntawm Arduino zej zog xws li lub tsev qiv ntawv rau kev tswj hwm lub cav servo, Ethernet, thiab lwm yam. Arduino IDE kuj tseem muaj kev xaiv rau nruab thiab siv cov tsev qiv ntawv sab nraud koj tuaj yeem ua koj tus kheej lub tsev qiv ntawv thiab teeb tsa lawv hauv Arduino IDE.

Txoj Kev Txhim Kho Tsev Kawm Ntawv Arduino

Muaj ob txoj hauv kev uas peb tuaj yeem teeb tsa tsev qiv ntawv hauv Arduino IDE ib qho yog los ntawm Arduino IDE Tus Thawj Saib Xyuas Tsev Kawm Ntawv thiab lwm qhov yog los ntawm kev siv.zip cov ntaub ntawv feem ntau ntawm cov tsev qiv ntawv muaj nyob ntawm Arduino Tus Thawj Saib Xyuas Tsev Qiv Ntawv tab sis muaj ntau lub tsev qiv ntawv uas tus tsim tawm ua los ntawm lawv tus kheej thiab ua rau lawv muaj nyob ntawm github yog li peb muaj ob qho kev xaiv tab sis peb tuaj yeem siv ib qho ntawm ob qho tib si.

Txhim Kho Tsev Qiv Ntawv Siv Tus Thawj Saib Xyuas Tsev Qiv Ntawv

Txhawm rau teeb tsa lub tsev qiv ntawv siv tus thawj tswj tsev qiv ntawv nyem rau kos-> suav nrog tsev qiv ntawv-> Tswj cov tsev qiv ntawv

Tom qab tus neeg saib xyuas lub tsev qiv ntawv no yuav qhib ntawm no koj tuaj yeem seelibraries uas twb tau teeb tsa. Hauv qhov piv txwv no peb yuav nruab RTCZero rau qhov no koj yuav tsum tshawb nrhiav rau RTCZero lub tsev qiv ntawv thaum koj pom nws xaiv nws cov version thiab nyem rau ntawm pob install, kev teeb tsa yuav pib.

Ntshuam ib lub tsev qiv ntawv.zip

Cov tsev qiv ntawv feem ntau faib ua ZIP cov ntaub ntawv lossis ntawv tais ceev tseg. Lub npe ntawm daim nplaub tshev yog lub npe ntawm lub tsev qiv ntawv. Sab hauv daim nplaub tshev yuav yog.cpp cov ntaub ntawv, a.h cov ntaub ntawv thiab feem ntau yog lo lus tseem ceeb.txt, piv txwv cov nplaub tshev, thiab lwm cov ntaub ntawv xav tau los ntawm lub tsev qiv ntawv.

Txhawm rau nruab zip lub tsev qiv ntawv nyem sketch-> Xws li Lub Tsev-> Ntxiv.zip Lub Tsev Qiv Ntawv

Qhov Qhib Qhov rai yuav qhib muaj teeb tsa qhov chaw nyob rau qhov twg zip qiv ntawv tau txais kev cawmdim thiab nyem rau ntawm qhib pob

Kauj ruam 15: Arduino IDE Shortcut Keys

Arduino IDE Shortcut Keys
Arduino IDE Shortcut Keys

Arduino IDE muaj qee tus yuam sij luv los ntawm qhov uas peb tuaj yeem ua haujlwm sib txawv xws li kev suav sau, xa nyiaj txuag thiab lwm yam.

Kauj Ruam 16: Arduino's IO Pins

Arduino's IO Pins
Arduino's IO Pins

Arduino yog pawg thawj coj saib xyuas uas feem ntau los nrog kev teeb tsa sib txawv ntawm I/O (cov tswv yim/tso tawm) pins, tus pin yog analog lossis digital pins,

Tus Pin Analog

Cov pins sib piv yog cov tswv yim tiag tiag uas feem ntau siv los nyeem cov ntaub ntawv lub cev raws li cov tswv yim lossis nws yog tus pin uas tuaj yeem nyeem cov ntaub ntawv lub cev los ntawm lub ntsuas cua, lub ntsuas cua yog lub cuab yeej uas tuaj yeem hloov pauv lub zog rau lub zog hluav taws xob. Arduino tuaj yeem nyeem lub zog hluav taws xob no raws li lub teeb liab hluav taws xob siv cov pin analog

Tus Pin

Tus lej tus lej tuaj yeem yog ob qho INPUT thiab OUTPUT tus pin yog li nws yog lub npe nws tuaj yeem nyeem INPUT thiab sau OUTPUT hauv daim ntawv digital. Cov ntaub ntawv digital yog nyob rau hauv daim ntawv ntawm HIGH lossis LOW qhov twg HIGH txhais tau tias ON thiab LOW txhais tau tias OFF piv txwv li yog tias coj mus txuas rau Arduino tus lej digital thiab koj ua haujlwm rau tus lej no kom HIGH thaum kawg tus coj yuav tau txais ON thiab los ntawm cov phiaj xwm nws kom tau qis lub led yuav tau OFF.

Mem tes dav tes taws los piav Pins

Qee qhov digital pins hauv Arduino muaj kev ua haujlwm ntxiv ntawm kev muab Analog Output thiab hu ua PWM pins, kev ua haujlwm ntawm PWM pins yog sau OUTPUT hauv ntau qib ntawm qib HIGH thiab LOW qib, cia peb xav tias coj txuas nrog PWM tus pin thiab koj xav tswj lub teeb ci ntawm coj lossis lub cev txuas nrog PWM tus pin thiab koj xav tswj lub nrawm ntawm lub cav koj tuaj yeem muab tus nqi ntawm 0-255 los tswj qhov ci lossis nrawm.

Kauj Ruam 17: Arduino LED Blink Program

Arduino LED Blink Program
Arduino LED Blink Program
Arduino LED Blink Program
Arduino LED Blink Program
Arduino LED Blink Program
Arduino LED Blink Program

Raws li Arduino IDE thiab tus tsav tsheb tau teeb tsa txuas rau program

Arduino kom ntsais ib qho khoom siv LED xav tau uas tau hais hauv qab no

Cheebtsam Siv rau LED Blink Project

● Arduino Uno

● USB Cable Hom A/B.

● 220 Ohm Resistor

Lub teeb pom kev zoo ntawm LED teeb pom kev zoo

● Cov qhob cij

Schematic

Txuas Arduino Uno tus pin 5 rau 220 ohm resistor thiab txuas lwm tus pin ntawm tus tiv thaiv rau Led tus anode (+) tus pin thiab txuas Arduino Uno's GND tus pin rau LED tus cathode (-) tus pin.

Kev Sau Ntawv kom ntsais tus LED

Kauj Ruam 1. Qhib Arduino IDE.

Kauj Ruam 2. Qhib daim duab tshiab

Kauj Ruam 3. Txuag qhov kos duab tshiab li LED BLINK PROGRAM thiab wite qhov program

Kauj Ruam 4. Xaiv Pawg Thawj Coj los ntawm txhaj Cov Cuab Yeej-> Pawg:-> Arduino Uno

Kauj Ruam 5. Xaiv qhov chaw nres nkoj COM los ntawm txhaj rau Tools-> Port

Kauj Ruam 6. Nyem rau ntawm Compile Button

Kauj Ruam 7. Tos kom muab tso ua ke kom tiav ces nyem rau Upload khawm

Koj yuav pom cov lus "Ua Ntej Uploading" raws li koj pom cov lus no coj txuas nrog ntawm tus pin 5 ntawm Arduino yuav zoo li ntsais muag tom qab ib pliag.

Kauj Ruam 18: Saib Xyuas Serial

Saib Xyuas
Saib Xyuas
Saib Xyuas
Saib Xyuas
Saib Xyuas
Saib Xyuas
Saib Xyuas
Saib Xyuas

Arduino IDE muaj qhov tshwj xeeb uas tuaj yeem pab tau zoo hauv kev debug cov duab kos lossis tswj Arduino los ntawm koj lub khoos phis tawj keyboard. Serial Monitor yog lub qhov rai sib cais uas ua raws li lub davhlau ya nyob twg cais uas sib txuas lus los ntawm kev tau txais thiab xa Cov Ntaub Ntawv Serial.

Koj tuaj yeem hloov kho qhov kev coj ua ntsais muag kom pom cov xwm txheej ntawm LED txuas ntawm tus pin 5 ntawm Arduino yog HIGH lossis LOW ntawm koj lub khoos phis tawj siv Arduino IDE tus lej saib xyuas siv kev sib txuas lus muaj peev xwm ntawm Arduino, rau ua qhov no ua ntej koj yuav tsum teeb tsa cov lej baudrate mus rau 9600 baud tus nqi yog yooj yim txhais raws li kev xa cov ntaub ntawv nrawm los ntawm Arduino mus rau lub khoos phis tawj lossis hloov pauv ntawm qhov me ntsis ib pliag yog li teev baud tus nqi rau 9600 yog zoo li kev xa xov nrawm yog 9600 ntsis ib ob.

Kev Sau Ntawv kom ntsais tus LED

Kauj Ruam 1. Qhib Arduino IDE.

Kauj Ruam 2. Qhib daim duab tshiab

Kauj Ruam 3. Txuag daim duab tshiab ua LED BLINK PROGRAM thiab sau qhov program

Kauj Ruam 4. Xaiv Pawg Thawj Coj los ntawm txhaj Cov Cuab Yeej-> Pawg:-> Arduino Uno

Kauj Ruam 5. Xaiv qhov chaw nres nkoj COM los ntawm txhaj Cov Cuab Yeej-> Chaw Nres Nkoj

Kauj Ruam 6. Nyem rau ntawm Compile Button

Kauj Ruam 7. Tos kom muab tso ua ke kom tiav ces nyem rau Upload khawm

Kauj Ruam 8. Qhib Serial Monitor los ntawm kev nias Ctrl+Shift+m lossis los ntawm txhaj rau ntawm kaum sab xis.

Kauj Ruam 9. Teeb Baud Tus Nqi ntawm Tus Saib Xyuas raws li ob qho tib si Arduino thiab Khoos phis tawj yuav tsum muaj tus lej baud tib yam rau kev sib txuas lus.

Ntawm no koj yuav pom sai li sai tau thaum LED tau HIGH lossis LOW cov lus tau luam tawm ib ntus ntawm Serial monitor

Pom zoo: