Cov txheej txheem:

RGB LED Xim Sib xyaw Nrog Arduino hauv Tinkercad: 5 Cov Kauj Ruam (nrog Duab)
RGB LED Xim Sib xyaw Nrog Arduino hauv Tinkercad: 5 Cov Kauj Ruam (nrog Duab)

Video: RGB LED Xim Sib xyaw Nrog Arduino hauv Tinkercad: 5 Cov Kauj Ruam (nrog Duab)

Video: RGB LED Xim Sib xyaw Nrog Arduino hauv Tinkercad: 5 Cov Kauj Ruam (nrog Duab)
Video: Hais Lus Xiav Wireless Xiav Cov Hniav Khoom Txhawb Kev Lag Luam Tuam Tshoj Chaw Tsim Tshuaj Tuam 2024, Hlis ntuj nqeg
Anonim
Image
Image
Duab
Duab

Tinkercad Cov Haujlwm »

Cia peb kawm paub yuav ua li cas tswj ntau xim LEDs siv Arduino cov txiaj ntsig sib piv. Peb yuav txuas RGB LED mus rau Arduino Uno thiab sau cov program yooj yim los hloov nws cov xim.

Koj tuaj yeem ua raws nrog kev siv Tinkercad Circuits. Koj tseem tuaj yeem saib cov lus qhia no los ntawm hauv Tinkercad (yuav tsum tau nkag nkag dawb)! Tshawb xyuas cov qauv piv txwv (nyem Pib Simulation los saib LED hloov xim) thiab tsim koj tus kheej txoj cai ib sab ntawm nws. Tinkercad Circuits yog qhov browser pub dawb uas tso cai rau koj tsim thiab sim ua cov kab hluav taws xob. Nws zoo meej rau kev kawm, kev qhia, thiab kev tsim qauv.

Txij li thaum koj yuav yog tus tshiab los siv lub khob cij, peb kuj tseem suav nrog cov kab xaim hluav taws xob pub dawb ntawm qhov kev sib tham no. Koj tuaj yeem tsim ob txoj hauv kev hauv Tinkercad Circuits editor, tab sis yog tias koj tseem tab tom tsim ib qho kev sib txuas nrog lub cev, lub khob cij yuav pab koj lub voj voog virtual zoo ib yam.

Nrhiav qhov Circuit Court no ntawm Tinkercad

Xaiv tau koj cov khoom siv hluav taws xob thiab tsim

nrog rau lub cev Arduino Uno, USB cable, breadboard, RGB LED, resistors (ib qho txiaj ntsig los ntawm 100-1K ohms yuav ua), thiab qee qhov xov tooj cua. Koj tseem yuav xav tau lub khoos phis tawj nrog software dawb Arduino (lossis txuas rau lub vev xaib khoos phis tawj).

Ntxiv, lossis xim raws lub teeb muaj peb yam xim: liab, ntsuab, thiab xiav. Sib tov peb cov xim no hauv qib sib txawv ntawm kev siv tau tuaj yeem tsim yuav luag txhua lub xim ntawm lub teeb. Cov xim hloov LEDs ua haujlwm ib yam nkaus, tab sis cov LEDs tau tag nrho ua ke hauv pob me peb hu ua RGB LED. Lawv muaj plaub ceg, ib qho rau txhua xim thiab ib qho rau hauv av lossis lub zog, nyob ntawm kev teeb tsa. Cov hom hu ua "common cathode" thiab "common anode," feem.

Kauj ruam 1: Tsim Circuit Court

Tsim Circuit Court
Tsim Circuit Court

Nrhiav qhov Circuit Court no ntawm Tinkercad

Hauv Tinkercad Circuits Cheebtsam cov khoom vaj huam sib luag, rub tus tshiab Arduino thiab cov ntawv ci rau ntawm ib sab ntawm tus qauv, thiab npaj koj lub rooj noj mov los ntawm kev txuas Arduino 5V mus rau txoj kev tsheb nqaj hlau thiab Arduino GND rau hauv av tsheb nqaj hlau.

Ntxiv RGB LED thiab tso nws hla plaub kab sib txawv ntawm lub khob cij. RGB LED hauv kev sim muaj ib qho cathode (tsis zoo, hauv av) ntawm nws ob txhais ceg, yog li xaim kab no/tus pin rau hauv av.

Ntxiv rau peb tus tiv thaiv (rub tag nrho peb lossis tsim ib qho thiab tom qab ntawd luam/muab tshuaj txhuam) thiab txav lawv mus rau kab kab noj mov rau peb seem LED pins, txuas hla lub khob cij lub hauv paus sib txawv rau peb kab sib cais ntawm lwm sab.

Txuas cov xov hlau los ntawm tus tiv thaiv dawb kawg thiab rau peb ntawm koj tus PWM-muaj peev xwm Arduino pins, uas tau cim nrog

tilde (me ntsis squiggle).

Txhim kho koj cov xov hlau los ntawm kev kho lawv cov xim (poob lossis lej yuam sij) thiab tsim khoov (nyem ob zaug).

Txawm hais tias koj yuav raug ntxias kom sib sau ua ke thiab siv ib tus neeg tawm tsam ntawm tus pin sib xws, tsis txhob! Txhua LED xav tau nws tus kheej resistor txij li lawv tsis kos tib yam tam sim no ib leeg.

Credit ntxiv: koj tuaj yeem kawm paub ntau ntxiv txog LEDs hauv chav qhia dawb LEDs thiab Chav Kawm Teeb pom kev zoo.

Kauj Ruam 2: Xim Sib tov Code Nrog Thaiv

Duab
Duab

Hauv Tinkercad Circuits, koj tuaj yeem yooj yim teeb tsa koj cov phiaj xwm siv block. Peb yuav siv tus kws kho qhov chaws los ntsuas qhov thaiv thiab kho cov xim LED. Nyem rau "Code" khawm kom qhib tus khoos phis tawj.

Duab
Duab

Koj tuaj yeem hloov pauv ntawm tus qauv piv txwv thiab koj tus kheej txoj haujlwm los ntawm kev xaiv pawg Arduino tshwj xeeb hauv lub dav hlau ua haujlwm (lossis cov ntawv qhia zaub mov qis dua tus lej code).

Luag tus RGB LED tso tawm qhov thaiv rau hauv qhov kev pab cuam dawb paug thiab kho qhov poob qis kom phim cov pins koj txuas ua ntej (11, 10, thiab 9).

Xaiv xim thiab nyem "Pib Simulation" los saib koj lub RGB LED teeb. Yog tias xim tsis zoo li, tej zaum koj yuav tsum pauv ob qho ntawm koj cov koob xim, xws li hauv kab lossis kab ntawv.

Tsim kom muaj lub teeb pom kev zoo los ntawm kev theej tawm koj lub RGB tso tawm qhov thaiv (txoj cai nyem-> theej tawm) thiab hloov xim, tom qab ntawd ntxiv qee qhov tos tos nyob nruab nrab. Koj tuaj yeem sim qhov kev sib tw ntawm kev sib tw, lossis hloov xim kom mus nrog koj cov nkauj nyiam. Kuj txheeb xyuas qhov rov ua dua- txhua yam uas koj muab tso rau hauv yuav tshwm sim rov ua dua rau cov sijhawm tshwj xeeb.

Kauj Ruam 3: Arduino Code Piav Qhia

Duab
Duab

Thaum tus lej hloov pauv tau qhib, koj tuaj yeem nyem cov ntawv qhia zaub mov nyob rau sab laug thiab xaiv "Thaiv + Ntawv" kom nthuav qhia Arduino code tsim los ntawm cov cai thaiv.

void teeb tsa ()

{pinMode (11, NTAWV); pinMode (10, NTAWV); pinMode (9, NTAWV); } tsis muaj dab tsi voj () {analogWrite (11, 255); analogWrite (10, 0); analogWrite (9, 0); ncua (1000); // Tos rau 1000 millisecond (s) analogWrite (11, 255); analogWrite (10, 255); analogWrite (9, 102); ncua (1000); // Tos rau 1000 millisecond (s)}

Tom qab teeb tsa tus pin raws li cov txiaj ntsig hauv kev teeb tsa, koj tuaj yeem pom cov cai siv

analogWrite ()

zoo li hauv zaj lus qhia zaum kawg ntawm fading LED. Nws sau txhua ntawm peb tus pin nrog tus nqi sib txawv, ua rau muaj xim sib xyaw.

Kauj Ruam 4: Tsim Lub Cev Lub Cev (Yeem Tau)

Tsim Lub Cev Lub Cev (Yeem Tau)
Tsim Lub Cev Lub Cev (Yeem Tau)

Txhawm rau teeb tsa koj lub cev Arduino Uno, koj yuav tsum teeb tsa software dawb (lossis txuas rau lub vev xaib khoos phis tawj), tom qab ntawd qhib nws.

Hlau txuas rau Arduino Uno Circuit los ntawm kev txuas cov khoom sib txuas thiab cov xov hlau kom phim cov kev sib txuas uas tau qhia hauv Tinkercad Circuits. Yog tias koj lub cev RGB LED tshwm sim los ua ib qho anode, tus pin thib ob yuav tsum tau txuas rau lub zog hloov pauv hauv av, thiab qhov ci ci qhov tseem ceeb 0-255 tau thim rov qab. Yog xav paub ntau ntxiv-taug kev ntawm kev ua haujlwm nrog koj lub cev Arduino Uno board, txheeb xyuas cov lus qhia dawb Arduino chav kawm (cov lus sib tham tau piav qhia hauv tshooj ob).

Luam cov cai los ntawm Tinkercad Circuits code lub qhov rai thiab muab nws tso rau hauv qhov kos duab khoob hauv koj li Arduino software, lossis nyem lub pob rub tawm (nqes mus rau xub xub xub) thiab qhib

qhov ua tiav cov ntaub ntawv siv Arduino.

Duab
Duab

Txuas koj lub USB cable thiab xaiv koj lub rooj tsavxwm thiab chaw nres nkoj hauv software cov cuab yeej ntawv qhia zaub mov.

Upload cov cai thiab saib koj cov LED hloov xim!

Kauj ruam 5: Tom ntej no, Sim…

Duab
Duab

Tam sim no koj paub tswj hwm RGB LEDs, nws yog lub sijhawm los ua kev zoo siab rau koj li kev ua tiav digital thiab analog! Siv cov txuj ci uas koj tau kawm dhau los ntawm kev tswj hwm ntau lub LEDs thiab siv analogWrite () kom ploj mus, koj tau tsim ib lub pixel zoo ib yam (me dua) nyob hauv cov ntxaij vab tshaus ntawm koj lub xov tooj ntawm tes, TV, thiab khoos phis tawj.

Sim npog koj lub LED nrog cov khoom sib txawv sib txawv los hloov lub teeb pom kev zoo. Koj tuaj yeem sim ua LED diffusers los ntawm txhua yam uas tso lub teeb pom kev, xws li ping pong npas, polyester fiber ntau sau, lossis 3D luam ntawv.

Tom ntej no hauv koj txoj kev taug Arduino, sim kawm txhawm rau txheeb xyuas cov tswv yim nrog lub pob nyem thiab

Nyeem digital ()

Koj tseem tuaj yeem kawm paub ntau yam txuj ci hluav taws xob nrog chav qhia dawb hauv Arduino, Cov Khoom Siv Hluav Taws Xob, LEDs & Teeb pom kev zoo, Luam Ntawv 3D, thiab ntau ntxiv.

Pom zoo: