Cov txheej txheem:
- Kauj Ruam 1: Qhov Chaw thiab Componets
- Kauj Ruam 2: Npaj Koj Txoj Kev Kawm
- Kauj Ruam 3: Yuav Siv Potentiometers li cas
- Kauj Ruam 4: Txuas Cov Qauv rau (3x) Potentiometer
- Kauj Ruam 5: Siv AnalogRead () thiab Variables
- Kauj Ruam 6: Siv Serial Monitor Nrog 1 Pob Ntseg
- Kauj Ruam 7: Siv RGB LED
- Kauj Ruam 8: Siv Potentiometers los Tswj RGB LED (nrog Ib Kab)
- Kauj Ruam 9: LUS QHIA: Daim ntawv qhia () Muaj nuj nqi thiab Txoj Cai Ntxuav
Video: Xim Tov Khoom Nrog Arduino: 9 Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:29
Los ntawm tliguori330 Ua raws ntau los ntawm tus sau:
Txog: Ib txwm kawm….. Ntxiv Txog tliguori330 »
Cov xim sib tov yog txoj haujlwm zoo rau txhua tus neeg ua haujlwm thiab loj hlob nrog Arduino. Txog qhov kawg ntawm cov lus qhia no koj yuav tuaj yeem sib xyaw thiab sib piv yuav luag txhua qhov xim xav tau los ntawm kev xa 3 pob qhov rooj. Cov txuj ci qib qis txaus uas txawm tias ua tiav rookie tuaj yeem ua tiav nws ua tiav, tab sis kuj tseem txaus txaus kom txaus siab rau tus kws kho tsiaj raws caij nyoog. Tus nqi ntawm txoj haujlwm no nyob ib sab tsis muaj dab tsi thiab cov khoom siv Arduino feem ntau tuaj nrog cov ntaub ntawv xav tau. Ntawm qhov tseem ceeb ntawm txoj cai no yog qee qhov kev siv nyiaj txiag arduino uas txhua tus siv arduino yuav xav nkag siab. Peb yuav nkag mus tob txog qhov analogRead () thiab analogWrite () ua haujlwm raws li peb ib txwm ua haujlwm ib txwm hu ua daim ntawv qhia (). Cov kev txuas no coj koj mus rau nplooj ntawv siv arduino rau cov haujlwm no.
Kauj Ruam 1: Qhov Chaw thiab Componets
Arduino Ib
Potentiometer (x3)
RGB LED
220 ohm resistor (x3)
Jumper xov hlau (x12)
Pawg mov ci
Kauj Ruam 2: Npaj Koj Txoj Kev Kawm
Nws tuaj yeem pab tau heev los npaj yuav ua li cas koj yuav ua tiav koj txoj haujlwm. Coding yog txhua yam hais txog kev muaj tswv yim zuj zus los ntawm ib qib mus rau lwm qhov. Kuv tau ua daim ntawv qhia ntxaws uas piav qhia qhov kuv xav kom kuv daim duab kos ua haujlwm. Lub hom phiaj tag nrho yog kom muaj 3 pob qhov rooj (potentiometers) tswj txhua ntawm peb xim ntawm RGB LED. Txhawm rau ua kom tiav qhov no peb yuav tsum tsim cov duab kos sib piv nrog daim ntawv ntws. Peb yuav xav….
1) Nyeem 3 lub zog sib txawv thiab khaws lawv cov txiaj ntsig hauv qhov sib txawv.
2) Peb yuav hloov cov txiaj ntsig no kom haum rau qhov sib txawv ntawm RGB LED.
3) Tom qab ntawv thaum kawg peb yuav sau cov txiaj ntsig hloov pauv no rau txhua qhov xim ntawm RGB.
Kauj Ruam 3: Yuav Siv Potentiometers li cas
Ib qho ntawm cov khoom siv yooj yim tshaj plaws hauv cov khoom siv hluav taws xob, lub tshuab hluav taws xob tuaj yeem siv hauv ntau qhov haujlwm sib txawv. potentiometers ua haujlwm los ntawm kev tso cai rau tus neeg siv lub cev hloov pauv qhov tsis kam ntawm Circuit Court. Qhov piv txwv zoo tshaj plaws ntawm cov potentiometer yog lub teeb dimmer. zawv zawg lossis tig lub pob qhov rooj hloov qhov ntev ntawm Circuit Court. txoj hauv kev ntev dua ua rau muaj kev tiv thaiv ntau dua. Qhov kev tiv thaiv ntau dua ua rau qis dua qhov tam sim no thiab lub teeb ci. Cov no tuaj yeem los ntawm txhua qhov sib txawv thiab qhov loj me tab sis feem ntau muaj tib qho teeb tsa yooj yim. Ib tus tub ntxhais kawm tau thov kev pabcuam kho nws lub guitar thiab peb pom tias cov pob qhov rooj ntawm nws zoo ib yam li cov potentiometers. Feem ntau koj yog ob txhais ceg sab nraud txuas rau 5 volts thiab hauv av thiab nruab nrab txhais ceg mus rau tus lej sib piv zoo li A0
Kauj Ruam 4: Txuas Cov Qauv rau (3x) Potentiometer
Sab laug feem ntau ceg yuav txuas nrog 5v thiab sab xis feem ntau yuav txuas nrog GND. Koj tuaj yeem thim rov qab ob kauj ruam no thiab nws yuav tsis ua rau txoj haujlwm hnyav heev. Txhua yam uas yuav hloov pauv tig lub pob qhov rooj mus rau sab laug yuav ci ntsa iab tag nrho ntawm txoj kev tawm. Cov ceg nruab nrab yuav txuas nrog ib qho ntawm cov pins sib piv ntawm Arduino. Txij li thaum peb yuav muaj peb lub pob qhov rooj, peb yuav xav ua peb npaug ntawm cov haujlwm uas peb nyuam qhuav ua. Txhua pob qhov rooj xav tau 5v thiab GND yog li cov ntawd tuaj yeem sib koom siv lub rooj noj mov. Cov kab liab liab ntawm lub rooj mov ci tau txuas nrog 5 Volts thiab kab txaij xiav txuas rau hauv av. Txhua lub pob qhov rooj xav tau nws tus kheej tus pin zoo li lawv tau txuas nrog A0, A1, A2.
Kauj Ruam 5: Siv AnalogRead () thiab Variables
Nrog koj potentiometer teeb tsa kom raug peb tau npaj los nyeem cov txiaj ntsig ntawd. Thaum txhua tus peb xav ua qhov no peb siv cov analogRead () ua haujlwm. Cov syntax raug yog analogRead (tus pin#); yog li los nyeem peb lub zog nruab nrab peb yuav analogRead (A1); Txhawm rau ua haujlwm nrog cov lej raug xa los ntawm pob qhov rooj mus rau Arduino, peb tseem yuav xav khaws cov lej ntawd hauv qhov sib txawv. Kab ntawm txoj cai yuav ua tiav txoj haujlwm no thaum peb nyeem lub hwj chim thiab khaws nws tus lej tam sim no hauv cov lej sib txawv "val"
int val = analogRead (A0);
Kauj Ruam 6: Siv Serial Monitor Nrog 1 Pob Ntseg
Tam sim no peb tuaj yeem tau txais qhov txiaj ntsig los ntawm cov pob qhov rooj thiab khaws cia hauv qhov sib txawv, tab sis nws yuav pab tau yog tias peb tuaj yeem pom cov txiaj ntsig no. Txhawm rau ua qhov no peb yuav tsum tau siv lub built -in saib xyuas. Cov cai hauv qab no yog thawj daim duab peb yuav ua tiag hauv Arduino IDE uas tuaj yeem rub tawm ntawm lawv lub xaib. Hauv qhov tsis muaj teeb tsa () peb yuav qhib cov pins sib txuas nrog txhua tus ceg nruab nrab ua INPUT thiab qhib lub Serial saib siv Serial.begin (9600); tom ntej no peb nyeem tsuas yog ib qho ntawm cov pob qhov rooj thiab khaws nws hauv qhov sib txawv xws li ua ntej. Qhov kev hloov pauv tam sim no yog peb ntxiv kab uas luam tawm tus lej twg khaws cia hauv qhov sib txawv. Yog tias koj suav sau thiab khiav cov duab kos koj tuaj yeem qhib koj lub Serial monitor thiab pom cov lej scrolling ntawm qhov screen. Txhua lub sijhawm cov lej loops peb tau nyeem thiab luam tawm lwm tus lej. Yog tias koj tig lub pob qhov rooj txuas nrog A0 koj yuav tsum pom qhov tseem ceeb xws li 0-1023. tom qab ntawm lub hom phiaj yuav tsum nyeem tag nrho 3 lub ntsuas hluav taws xob uas yuav xav tau 2 ntau qhov analogReads thiab 2 qhov sib txawv sib txawv kom txuag tau thiab luam tawm.
void teeb tsa () {
pinMode (A0, INPUT); pinMode (A1, INPUT); pinMode (A2, INPUT); Serial.begin (9600); } void loop () {int val = analogRead (A0); Serial.println (nqi); }
Kauj Ruam 7: Siv RGB LED
4 Legged RGB LED kuv yog ib qho kuv nyiam tshaj plaws rau Arduino. Kuv pom Txoj hauv kev nws tuaj yeem tsim cov xim tsis muaj qhov kawg los ntawm kev sib xyaw ntawm 3 ntawm cov xim yooj yim txaus nyiam. Kev teeb tsa zoo ib yam li ib txwm LED tab sis ntawm no peb ib txwm muaj liab, xiav thiab ntsuab LEDs ua ke ua ke. Cov ceg luv yuav txhua tus raug tswj los ntawm ib qho ntawm PWM pins ntawm arduino. Cov ceg ntev tshaj plaws yuav txuas nrog 5 volts lossis hauv av, nyob ntawm seb koj nyob hauv ib qho anode lossis cathode LED ib txwm muaj. Koj yuav tsum tau sim ua ob txoj hauv kev los daws qhov teeb meem no. Peb yuav twb muaj 5v thiab GND txuas nrog lub khob cij rau nws yuav tsum yooj yim hloov pauv. Daim duab saum toj no qhia siv 3 tus tiv thaiv ib yam nkaus. Kuv hla qhov kauj ruam no ntau zaus vim kuv tsis tau muaj thiab LED tshuab rau kuv.
Txhawm rau xim peb yuav siv cov analogWrite () ua haujlwm los tswj ntau npaum li cas liab, xiav, lossis ntsuab ntxiv. Txhawm rau siv txoj haujlwm no koj yuav tsum hais tus pin# peb yuav tham nrog thiab tus lej ntawm 0-255. 0 tawm tag thiab 255 yog qhov siab tshaj plaws ntawm ib qho xim. Cia txuas tus ceg liab rau tus pin 9, ntsuab rau tus pin 10 thiab xiav rau tus pin 11. Qhov no yuav siv qee qhov kev sim thiab yuam kev los txiav txim seb ceg twg yog xim twg. Yog tias kuv xav ua cov xim ntshav kuv tuaj yeem ua ntau xim liab, tsis muaj ntsuab, thiab tej zaum ib nrab ntawm lub zog xiav. Kuv txhawb koj kom tinker nrog cov lej no, nws zoo siab heev. Qee qhov piv txwv muaj nyob hauv cov duab saum toj no
void teeb tsa () {
pinMode (9, NTAWV); pinMode (10, NTAWV); pinMode (11, NTAWV); } void loop () {analogWrite (9, 255); analogWrite (10, 0); analogWrite (11, 125)}
Kauj Ruam 8: Siv Potentiometers los Tswj RGB LED (nrog Ib Kab)
Nws yog lub sijhawm los pib fusing peb ob tus lej ua ke. Koj yuav tsum muaj chav txaus nyob ntawm tus txheej txheem khob cij kom haum txhua 3 pob qhov rooj thiab RGB LED. Lub tswv yim tsis yog hloov pauv ntawm qhov muaj nuj nqis rau liab xiav thiab ntsuab, peb yuav siv qhov txiaj ntsig tau txais kev cawm dim los ntawm txhua lub poteniometer kom hloov pauv cov xim tas li. peb yuav xav tau 3 qhov sib txawv hauv qhov no. redval, greenval, blueval yog txhua qhov sib txawv sib txawv. Nco ntsoov koj tuaj yeem tso npe cov hloov pauv no txhua yam koj xav tau. yog tias koj tig lub pob "ntsuab" thiab qhov liab hloov pauv, koj tuaj yeem hloov cov npe kom phim kom raug. tam sim no koj tuaj yeem tig txhua pob qhov rooj thiab tswj cov xim !!
void teeb tsa () {
pinMode (A0, INPUT); pinMode (A1, INPUT); pinMode (A2, INPUT); pinMode (9, NTAWV); pinMode (10, NTAWV); pinMode (11, NTAWV); } void teeb () {int redVal = analogRead (A0); int ntsuabVal = analogRead (A1); int blueVal = analogRead (A2); analogWrite (9, redVal); analogWrite (10, ntsuabVal); analogWrite (11, blueVal); }
Kauj Ruam 9: LUS QHIA: Daim ntawv qhia () Muaj nuj nqi thiab Txoj Cai Ntxuav
Koj yuav pom tias thaum koj pib tig lub pob qhov rooj rau ib qho xim nws yuav loj tuaj thiab tom qab ntawd mam li nco dheev poob mus. Cov qauv no ntawm kev loj hlob thiab tom qab kaw nrawm dua 4 zaug thaum koj tig lub pob qhov rooj tag nrho. Yog tias koj nco qab peb tau hais tias lub hwj chim muaj peev xwm nyeem tau qhov tseem ceeb ntawm 0 thiab 1023. Cov analogWrite () muaj nuj nqi tsuas yog lees txais qhov tseem ceeb ntawm 0 thiab 255. ib zaug cov potentiometer mus dhau 255 nws pib pib ntawm 0. Muaj qhov ua haujlwm zoo los pab nrog kab hu ua daim ntawv qhia (). koj tuaj yeem hloov pauv ib qho ntawm cov lej mus rau lwm qhov ntawm cov lej hauv ib qib. peb yuav hloov tus lej los ntawm 0-1023 rau tus lej los ntawm 0-255. Piv txwv li yog tias lub pob qhov rooj tau teeb tsa ib nrab nws yuav tsum nyeem txog 512. tus lej ntawd yuav raug hloov mus rau 126 uas yog ib nrab lub zog rau LED. Hauv qhov kev kos duab zaum kawg no kuv tau teev cov pins nrog cov npe sib txawv rau kuv qhov yooj yim. Tam sim no koj tau ua tiav cov xim sib tov los sim nrog !!!
// cov npe sib txawv rau cov potentiometer pins
int redPot = A0; int greenPot = A1; int bluePot = A2 // cov npe sib txawv rau RGB pins int redLED = 9; int ntsuab LED = 10; int blueLED = 11; teeb tsa tsis muaj dab tsi () {pinMode (redPot, INPUT); pinMode (greenPOT, INPUT); pinMode (bluePot, INPUT); tus pinMode (redLED, OUTPUT); pinMode (ntsuab LED, NTAWV); tus pinMode (blueLED, OUTPUT); Serial, pib (9600); } void loop () {// nyeem thiab khaws qhov tseem ceeb los ntawm potentiometers int redVal = analogRead (redPot); int ntsuabVal = analogRead (greenPot); int blueVal - analogRead (bluePot); // hloov qhov tseem ceeb ntawm 0-1023 rau 0-255 rau RGB LED redVal = daim ntawv qhia (redVal, 0, 1023, 0, 255); greenVal = daim ntawv qhia (greenVal, 0, 1023, 0, 255); blueVal = daim ntawv qhia (blueVal, 0, 1023, 0, 255); // sau cov txiaj ntsig hloov pauv no rau txhua xim ntawm RGB LED analogWrite (redLED, redVal); anaogWrite (ntsuab LED, ntsuabVal); analogWrite (blueLED, blueVal); // qhia qhov tseem ceeb ntawm Serial monitor Serial.print ("liab:"); Serial.print (redVal); Serial.print ("ntsuab:"); Serial.print (ntsuabVal); Serial.print ("xiav:"); Serial.println (blueVal); }
Pom zoo:
MESOMIX - Automated Xim Xim Xim Tshuab: 21 Cov Kauj Ruam (nrog Duab)
MESOMIX - Automated Xim Xim Xim Tshuab: Koj puas yog tus tsim qauv, tus kws kos duab lossis tus neeg muaj tswv yim uas nyiam tha xim rau ntawm koj daim ntaub, tab sis feem ntau nws nyuaj thaum nws los ua qhov ntxoov ntxoo uas xav tau. uas tawm tsam rau huab cua nyias. Raws li cov cuab yeej no, koj
Cov xim pleev xim ntau xim (Kov Rhuav): 8 Kauj Ruam (nrog Duab)
Cov xim pleev xim ntau xim (Kov Rhuav): Teeb duab yog cov txheej txheem thaij duab siv los tsim cov teebmeem tshwj xeeb ntawm qhov kaw qhov nrawm. Lub teeb nyem feem ntau yog siv rau "xim" cov duab. Hauv Cov Lus Qhia no, Kuv yuav qhia koj yuav ua li cas txhawm rau tsim txhua yam hauv ib tus kws pleev xim nrog kov
Cia Ua Lub Mini Tov Khoom Nrog Cov Khoom Siv Tau Rov Los: 6 Cov Kauj Ruam
Cia Ua Lub Mini Tov Khoom Nrog Cov Khoom Siv Rov Los Siv Tau: Nyob zoo, Kuv yog Hilal, Hauv txoj haujlwm no, peb ua peb cov khoom siv tov khoom siv rov ua dua tshiab. Koj tuaj yeem yooj yim tuav qe, mis, yogurt thiab txhua yam kua uas tuaj rau koj lub siab. Koj tuaj yeem ua koj lub ncuav qab zib nrog koj tus kheej tov! :) Peb tau ua yogurt nrog cov txiv ntoo hauv cov vis dis aus:
Hack ib daim duab thav duab nrog koj Cov Khoom Siv Hluav Taws Xob Xim Xim: 10 Kauj Ruam
Hack ib daim duab thav duab nrog koj Cov Khoom Siv Xim Xim Teeb: Cov Khoom Siv Teeb Xim Xim yog txoj hauv kev zoo kom koj pib thiab tsim cov phiaj xwm nrog Lub Teeb Pom Kev Teeb thiab Hluav Taws Xob Xim. Tab sis yog tias koj xav kom tau txais kev muaj tswv yim nrog Light Up Board, tom qab ntawv qhia no yog qhov chaw zoo pib! Hauv qhov kev qhia no
Hloov-Hloov Cov Khoom Ua Si: Ua Si @ Tsev Tov Khoom Ua Tau!: 7 Cov Kauj Ruam (nrog Duab)
Switch-Adapt Toys: a Play @ Home Mixer Made Accessible!: Qho khoom ua si hloov pauv qhib txoj hauv kev tshiab thiab kev daws teeb meem kom tso cai rau cov menyuam uas muaj lub cev muaj peev xwm txwv lossis kev xiam oos qhab kev loj hlob los cuam tshuam nrog cov khoom ua si ntawm nws tus kheej. Hauv ntau qhov xwm txheej, cov menyuam uas xav tau cov khoom ua si hloov pauv tsis tuaj yeem