Cov txheej txheem:

Yuav Ua Li Cas Tswj WS2812 RGB LED (NeoPixel) W/ Arduino [Tutorial]: 10 Kauj Ruam
Yuav Ua Li Cas Tswj WS2812 RGB LED (NeoPixel) W/ Arduino [Tutorial]: 10 Kauj Ruam

Video: Yuav Ua Li Cas Tswj WS2812 RGB LED (NeoPixel) W/ Arduino [Tutorial]: 10 Kauj Ruam

Video: Yuav Ua Li Cas Tswj WS2812 RGB LED (NeoPixel) W/ Arduino [Tutorial]: 10 Kauj Ruam
Video: Yuav Ua Li Cas Thiaj Kovyeej Kev Ntxeev Ntxias? | Part 1 | Kx. Ntxoov Lis Yaj 2024, Hlis ntuj nqeg
Anonim

Los ntawm ElectropeakElectroPeak Lub Vev Xaib Ua Haujlwm Ntxiv Ntxiv los ntawm tus sau:

Pib Nrog Ultrasonic Module thiab Arduino
Pib Nrog Ultrasonic Module thiab Arduino
Pib Nrog Ultrasonic Module thiab Arduino
Pib Nrog Ultrasonic Module thiab Arduino
Tsim WiFi Daim Ntawv Qhia Kub Thaum Siv ESP8266 & Arduino
Tsim WiFi Daim Ntawv Qhia Kub Thaum Siv ESP8266 & Arduino
Tsim WiFi Daim Ntawv Qhia Kub Thaum Siv ESP8266 & Arduino
Tsim WiFi Daim Ntawv Qhia Kub Thaum Siv ESP8266 & Arduino
Kev Paub Xim W/ TCS230 Sensor thiab Arduino [Calibration Code Included]
Kev Paub Xim W/ TCS230 Sensor thiab Arduino [Calibration Code Included]
Kev Paub Xim W/ TCS230 Sensor thiab Arduino [Calibration Code Included]
Kev Paub Xim W/ TCS230 Sensor thiab Arduino [Calibration Code Included]

Txog: ElectroPeak yog koj qhov chaw ib-nres los kawm cov khoom siv hluav taws xob thiab coj koj lub tswv yim mus rau qhov tseeb. Peb muab cov lus qhia saum toj kawg nkaus los qhia koj li cas koj tuaj yeem ua koj cov phiaj xwm. Peb kuj tseem muab cov khoom lag luam zoo yog li koj muaj … Ntau Ntxiv Txog Electropeak »

Txheej txheem cej luam

NeoPixel LEDs tau siv dav nyob rau niaj hnub no hauv cov phiaj xwm hluav taws xob, vim yog lawv qhov ntxim nyiam ntxim nyiam. Cov LEDs no muaj nyob rau ntau qhov ntau thiab tsawg thiab cov duab thiab hauv daim ntawv sawb. Hauv qhov kev qhia no, koj yuav kawm txog NeoPixel LEDs thiab yuav tswj hwm lawv li cas nrog Arduino.

Yam Koj Yuav Kawm

  • NeoPixel yog dab tsi
  • Vim li cas NeoPixel
  • cuam tshuam NeoPixel nrog Arduino

Khoom siv

Kho vajtse Cheebtsam

WS2812 RGB LED Ntiv Nplhaib Module *1

Arduino Uno R3 *1

Software Apps

Arduino IDE Cov

Kauj Ruam 1: NeoPixel yog dab tsi?

NeoPixel yog dab tsi?
NeoPixel yog dab tsi?
NeoPixel yog dab tsi?
NeoPixel yog dab tsi?

Tom qab xyoo 1962, thaum thawj LED tau tsim thiab ntsuas, qhov khoom muaj txiaj ntsig no tau dhau los ua ib feem ntawm peb lub neej. Hauv cov phiaj xwm hluav taws xob feem ntau, koj tuaj yeem pom tsawg kawg ib qho LED. Siv cov LEDs hauv cov xim sib txawv tau ntxim nyiam heev uas nws ua rau muaj ntau yam xim LEDs lossis RGB LEDs.

RGB LED tsim txhua qhov xim raws li peb xim ntawm liab, ntsuab, thiab xiav. piv txwv li, kev sib xyaw liab thiab xiav ua rau muaj xim daj. Hauv cov qauv no, txhua xim muaj tus nqi nruab nrab ntawm 0 thiab 255 rau txhua xim liab, ntsuab thiab xiav. Piv txwv li, cov txiaj ntsig no yog 255 0 255 (siab tshaj plaws liab, siab tshaj plaws xiav, thiab yam tsawg ntsuab ntsuab) rau Magenta. Tus lej lej no tau hais los ntawm Hex code (2550255 = # FF00FF). RGB LEDs ua ntau yam xim raws tus qauv no.

Txhawm rau tswj txhua RGB LED, koj xav tau peb tus pin digital ntawm microcontroller (lossis cov laug cam txhim kho zoo li Arduino). Piv txwv li, yog tias koj xav tswj RGB LED txoj hlua uas muaj 60 LEDs, txhawm rau tswj cov xim ntawm txhua LED sib cais, koj xav tau 180 tus pin digital! Yog li koj yuav tsum hnov qab tswj hwm txhua tus LED ib tus zuj zus lossis siv LEDs uas hais tau. LEDs nyob tau yog lub cim tshiab ntawm LEDs suav nrog tus tswj IC, ntxiv rau RGB LEDs. Tus tswj hwm IC no, feem ntau yog WS2812, tso cai rau koj nkag mus rau ntau lub LEDs nrog ib tus lej digital los ntawm kev muab chaw nyob rau txhua tus LED thiab muab kev sib txuas xov hlau. Tab sis tsis zoo li LEDs yooj yim, cov hom LEDs no tsis qhib tsuas yog siv qhov ntsuas hluav taws xob, lawv kuj xav tau lub microcontroller. NeoPixel yog Adafruit hom rau LEDs nyob tau.

Kauj Ruam 2: Vim Li Cas NeoPixel?

Vim li cas NeoPixel?
Vim li cas NeoPixel?

Lub peev xwm los tswj txhua tus LED hauv kab LED yuav tsim qhov pom kev zoo hauv koj cov phiaj xwm. Tab sis nws yuav tsum tau sau tseg tias hauv cov txheej txheem nrawm heev xws li POVs, kev siv NeoPixels tsis pom zoo. Lwm qhov txiaj ntsig tseem ceeb ntawm NeoPixels yog lawv tus nqi qis dua piv rau lwm qhov chaw nyob LEDs. NeoPixels kuj tseem muaj nyob hauv lub nplhaib, kab txaij, xwmfab thiab cov qauv ncig thiab koj tuaj yeem xaiv tus qauv haum raws li koj qhov project.

Neopoxes kuj tseem tuaj yeem sib txuas tau, yog li koj tuaj yeem tswj tau ntau NeoPixels nrog tsuas yog ib kab hais kom ua thiab ib kab kab.

Nco tseg Ua kom muaj pes tsawg NeoPixel LEDs yuav xav tau ntau RAM, ntau lub zog thiab ntau lub sijhawm ua haujlwm, yog li xaiv qhov zoo tshaj plaws NeoPixel raws li koj lub microcontroller hom.

Kauj Ruam 3: Cov Ntaub Ntawv Xav Tau

Cov Ntaub Ntawv Yuav Tsum Tau
Cov Ntaub Ntawv Yuav Tsum Tau

Kauj Ruam 4: NeoPixel thiab Arduino cuam tshuam

NeoPixel thiab Arduino cuam tshuam
NeoPixel thiab Arduino cuam tshuam
NeoPixel thiab Arduino cuam tshuam
NeoPixel thiab Arduino cuam tshuam

Nco tseg Tus tiv thaiv yuav tsum tau siv los tiv thaiv NeoPixel los ntawm kev puas tsuaj thiab xa cov ntaub ntawv kom raug.

Nco tseg Yog tias koj siv kab txaij LED uas muaj cov lej siab ntawm LEDs, peb pom zoo kom koj tso lub capacitor loj (piv txwv li 1000uf) ua ke nrog + thiab - ntawm qhov muab hluav taws xob.

Nco tseg Qhov zoo tshaj plaws los txuas thawj NeoPixel module yog li ntawm 1 txog 2 metres los ntawm pawg tswj hwm.

Kauj Ruam 5: Ex.1: Teeb NeoPixel Nrog Arduino

Hauv qhov piv txwv no, koj yuav tig rau NeoPixels thiab tswj cov xim thiab kev siv ntawm txhua LED cais siv Arduino UNO. Siv NeoPixel Adafruit lub tsev qiv ntawv los teeb tsa NeoPixel nrog Arduino.

Kev piav qhia Code

Adafruit_NeoPixel pixels (NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

Cov haujlwm saum toj no txiav txim siab tus naj npawb ntawm LEDs thiab Arduino pins.

pixels.begin ();

Cov haujlwm no ua qhov pib.

pixel.setBrightness (b);

Kev ua haujlwm saum toj no teeb tsa lub teeb ci. (Tus lej tsawg kawg yog 1 thiab tus lej siab tshaj yog 255.)

pixels.setPixelColor (Wich LED, Xim twg (Liab, Ntsuab, Xiav));

Txhais cov xim LED nrog RGB system, tom qab qhia tus lej LED (ntawm 0 txog NUMPIXELS-1).

pixels.show ();

Qhia cov txiaj ntsig tau thov.

Kauj Ruam 6: Ex.2: NeoPixel Blinking Mode Nrog Arduino

Hauv qhov piv txwv no, peb teeb tsa NeoPixels hauv hom ntsais muag. Txhawm rau ua qhov muag ntsais, txhua lub LEDs yuav tsum qhib thiab tua tib lub sijhawm, thiab lawv tuaj yeem muaj xim sib txawv thaum lawv qhib.

Kauj Ruam 7: Ex.3: NeoPixel Fading Mode Nrog Arduino

Fading yog ib qhov ntxim nyiam ntawm NeoPixels. Qhov qeeb qeeb, qhov ua tau zoo yuav zoo dua.

Kauj Ruam 8: Ex.4: NeoPixel Random Mode Nrog Arduino

Hauv qhov piv txwv no, peb siv qhov kev xaiv (tus lej 1, tus lej 2) los tsim thiab tso saib tus lej tsis raug ntawm tus lej 1 thiab tus lej 2 kom xaiv xim thiab LED.

Kauj Ruam 9: Ex.4: NeoPixel Rainbow Mode Nrog Arduino

Ex.4: NeoPixel Zaj sawv hom nrog Arduino
Ex.4: NeoPixel Zaj sawv hom nrog Arduino
Ex.4: NeoPixel Zaj sawv hom nrog Arduino
Ex.4: NeoPixel Zaj sawv hom nrog Arduino
Ex.4: NeoPixel Zaj sawv hom nrog Arduino
Ex.4: NeoPixel Zaj sawv hom nrog Arduino

Ib qho ntawm cov cuab yeej nthuav tshaj plaws hauv lub vev xaib, los tsim cov teebmeem ntawm NeoPixels yog NeoPixel Effects Generator, uas tso cai rau koj qhia tus lej ntawm LEDs thiab Arduino pins, thiab tom qab tsim cov teebmeem thiab xav tau teeb tsa, koj tuaj yeem nyem rau ntawm tsim Arduino code thiab luam cov cai tsim tawm rau IDE. Txhawm rau ua qhov no, ua cov theem hauv qab no:

  1. Nyem rau ntawm Ntxiv Led Sawb tom qab nkag mus rau lub vev xaib.
  2. Nyem rau ntawm qhov ntxiv NeoPixel Sawb thiab qhia tus lej ntawm LEDs thiab Arduino pins.
  3. Nyem rau ntawm Add Effect hauv ntu ntu thiab xaiv cov nyhuv.
  4. Siv koj qhov kev nyiam hauv ntu Animation thiab Xim.
  5. Nyem rau ntawm tsim Arduino code thiab luam cov cai tsim rau Arduino IDE.

Kauj ruam 10: Dab tsi ntxiv?

  • Kuaj lwm qhov cuam tshuam ntawm koj NeoPixel.
  • Sim tswj koj tus NeoPixel wirelessly. (WiFi, Bluetooth,…)

Cov Lus Qhia Zoo sib xws

Ua si nrog Hluav Taws Hla WIFI! ESP8266 & NeoPixels (Xws li Android App)

Pom zoo: