Cov txheej txheem:
- Kauj Ruam 1: Cheeb Tsam
- Kauj Ruam 2: Txoj Cai
- Kauj Ruam 3: Daim Duab Schematic
- Kauj ruam 4: Cov txheej txheem
- Kauj ruam 5: Code
Video: RGB LED Nrog Arduino Uno R3: 7 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:27
Yav dhau los peb tau siv PWM thev naus laus zis los tswj LED kom ci thiab tsaus. Hauv zaj lus qhia no, peb yuav siv nws los tswj lub RGB LED kom nyem ntau yam xim. Thaum sib txawv PWM qhov tseem ceeb tau teeb tsa rau R, G, thiab B pins ntawm LED, nws qhov ci yuav txawv. Thaum peb qhov sib txawv xim sib xyaw, peb tuaj yeem pom tias RGB LED ua rau pom cov xim sib txawv.
Kauj Ruam 1: Cheeb Tsam
- Arduino Uno board * 1
- USB cable * 1
- Tus tiv thaiv (220Ω) * 1
- RGB LED * 3
- Daim phiaj * 1
- Jumper xov hlau
Kauj Ruam 2: Txoj Cai
RGB LED txhais tau tias liab, xiav thiab ntsuab LEDs. RGB LED tau
tso cov xim sib txawv los ntawm kev sib xyaw 3 xim yooj yim liab, ntsuab thiab xiav. Yog li nws tiag tiag suav nrog 3 cais LEDs liab, ntsuab thiab xiav ntim rau hauv ib rooj plaub. Tias yog vim li cas nws muaj 4 tus coj, ib tus coj rau txhua ntawm 3 xim thiab ib qho cathode lossis anode nyob ntawm seb hom RGB LED. Hauv qhov kev qhia no kuv yuav siv cov cathode ib txwm.
Kauj Ruam 3: Daim Duab Schematic
Kauj ruam 4: Cov txheej txheem
Hauv qhov kev sim no, peb tseem yuav siv PWM uas, yog tias koj tau ua raws cov lus qhia txog tam sim no, koj twb muaj kev nkag siab yooj yim ntawm. Ntawm no peb tawm tswv yim tus nqi nruab nrab ntawm 0 thiab 255 rau peb tus pin ntawm RGB LED kom nws pom cov xim sib txawv. Tom qab txuas tus pin ntawm R, G, thiab B rau qhov txwv tam sim no, txuas lawv rau tus pin 9, tus pin 10, thiab tus pin 11 feem. Tus pin ntev tshaj (GND) ntawm LED txuas rau GND ntawm Uno. Thaum peb tus pin raug muab sib txawv PWM qhov tseem ceeb, RGB LED yuav tso tawm xim sib txawv.
Kauj ruam 1:
Tsim lub voj voog.
Kauj ruam 2:
Rub tawm cov cai los ntawm
Kauj ruam 3:
Tshaj tawm cov duab kos rau Arduino Uno board
Nyem rau Upload icon txhawm rau upload cov cai rau pawg tswj hwm.
Yog tias "Ua tiav uploading" tshwm nyob rau hauv qab ntawm lub qhov rais, nws txhais tau hais tias daim duab tau ua tiav tiav.
Ntawm no koj yuav tsum pom RGB LED nyem ncig liab, ntsuab, thiab xiav ua ntej, tom qab ntawd liab, txiv kab ntxwv, daj, ntsuab, xiav, indigo, thiab ntshav.
Kauj ruam 5: Code
// RGBLED
// Cov
RGB LED yuav tshwm liab, ntsuab, thiab xiav ua ntej, tom qab ntawd liab, txiv kab ntxwv, daj, ntsuab, xiav, indigo, thiab ntshav.
// Web site: www.primerobotics.in
/*************************************************************************/
qhov
int redPin = 11; // R petal ntawm RGB LED module txuas nrog tus pin 11
qhov
int greenPin = 10; // G petal ntawm RGB LED module txuas nrog tus pin 10
qhov
int bluePin = 9; // B petal ntawm RGB LED module txuas nrog tus pin 9
/**************************************************************************/
tsis muaj dab tsi
teeb ()
{
pinMode (redPin, OUTPUT); // teeb tsa redPin
los ua qhov tso tawm
tus pinMode (greenPin, OUTPUT); // teev cov
greenPin los ua qhov tso tawm
tus pinMode (bluePin, OUTPUT); // teeb tsa bluePin
los ua qhov tso tawm
}
/***************************************************************************/
tsis muaj dab tsi
loop () // khiav ntau thiab ntau dua
{
// Cov xim yooj yim:
xim (255, 0, 0); // tig RGB LED liab
ncua (1000); // ncua rau 1 thib ob
xim (0, 255, 0); // tig lub RGB LED
ntsuab
ncua (1000); // ncua rau 1 thib ob
xim (0, 0, 255); // tig lub RGB LED
xiav
ncua (1000); // ncua rau 1 thib ob
// Piv txwv cov xim sib xyaw:
xim (255, 0, 252); // tig lub RGB LED
liab
ncua (1000); // ncua rau 1 thib ob
xim (237, 109, 0); // tig lub RGB LED
txiv kab ntxwv
ncua (1000); // ncua rau 1 thib ob
xim (255, 215, 0); // tig lub RGB LED
daj
ncua (1000); // ncua rau 1 thib ob
xim (34, 139, 34); // tig lub RGB LED
ntsuab
ncua (1000); // ncua rau 1 thib ob
xim (0, 112, 255); // tig RGB LED xiav
ncua (1000); // ncua rau 1 thib ob
xim (0, 46, 90); // tig lub RGB LED indigo
ncua (1000); // ncua rau 1 thib ob
xim (128, 0, 128); // tig lub RGB LED
liab doog
ncua (1000); // ncua rau 1 thib ob
}
/******************************************************/
tsis muaj dab tsi
xim (tsis kos npe liab, tsis kos npe ntsuab, tsis kos npe xiav) // xim tsim muaj nuj nqi
{
analogWrite (redPin, liab);
analogWrite (greenPin, ntsuab);
analogWrite (bluePin, xiav);
}
/******************************************************/
Pom zoo:
Hloov-Hloov Cov Khoom Ua Si: Cov Khoom Ua Si Cov Khoom Ua Si Ua Tau Zoo!: 7 Cov Kauj Ruam (nrog Duab)
Hloov-Hloov Cov Khoom Ua Si: Cov Khoom Siv Hluav Taws Xob Ua Tau Zoo!: Qho khoom ua si hloov pauv qhib txoj hauv kev tshiab thiab kev daws teeb meem kom tso cai rau menyuam yaus 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 yaus uas xav tau cov khoom ua si hloov pauv tsis tuaj yeem nkag mus
Yuav Ua Li Cas Vaum Thiab Kub Tiag Tiag Cov Ntaub Ntawv Teev Npe Nrog Arduino UNO thiab SD-Card - DHT11 Cov ntaub ntawv-logger Simulation hauv Proteus: 5 Cov Kauj Ruam
Yuav Ua Li Cas Vaum Thiab Kub Tiag Tiag Cov Ntaub Ntawv Teev Npe Nrog Arduino UNO thiab SD-Card | DHT11 Cov ntaub ntawv-logger Simulation hauv Proteus: Taw qhia: nyob zoo, qhov no yog Liono Maker, ntawm no yog YouTube txuas. Peb tab tom tsim txoj haujlwm muaj tswv yim nrog Arduino thiab ua haujlwm ntawm cov kab ke. Cov ntaub ntawv-Logger: Cov ntaub ntawv logger (tseem cov ntaub ntawv-logger lossis cov ntaub ntawv kaw) yog cov cuab yeej siv hluav taws xob uas sau cov ntaub ntawv dhau sijhawm
Tutorial to Interface RGB Led WS2812B Nrog Arduino UNO: 7 Cov Kauj Ruam (nrog Duab)
Tutorial to Interface RGB Led WS2812B Nrog Arduino UNO: Cov ntawv qhia no yuav qhia koj qee qhov pib ntawm kev siv Sparkfun RGB Led WS2812B nrog Arduino UNO
Cov cuab yeej cuab tam - Ceramic hauv Cov Ntsiab Lus ntawm Cov Txheej Txheem Digital thiab Analog 2015: 3 Cov Kauj Ruam (nrog Duab)
Cov cuab yeej cuab tam - Ceramic hauv Cov Ntsiab Lus ntawm Digital thiab Analog Cov Txheej Txheem 2015: Txog tam sim no, cov khoom siv hlau yog cov khoom siv tes ua uas tsis muaj kev cuam tshuam digital. Vim li no, nws zoo siab heev los ua phooj ywg nrog cov cuab yeej tshiab. Lub hauv paus pib yog daim ntawv qub thiab CNC Styrocutter.DESIGNBOOM
Tswj Cov Khoom Siv Los Ntawm Arduino Nrog Cov Neeg Siv Khoom Hloov: 8 Cov Kauj Ruam (nrog Duab)
Kev Tswj Cov Khoom Siv Los Ntawm Arduino Nrog Kev Siv Hluav Taws Xob: Lub Arduino tuaj yeem siv los tswj cov cuab yeej los ntawm kev siv cov khoom siv yooj yim hloov pauv hloov chaw