Mundarija:
2025 Muallif: John Day | [email protected]. Oxirgi o'zgartirilgan: 2025-01-13 06:58
Bu yo'riqnomada biz neopixel yoki ws 2812 yoki Arduino bilan tezkor LEDni ishlatishni o'rganamiz, bu turdagi LED yoki tasma yoki uzuk faqat bitta pinli pin yordamida boshqariladi va barcha LEDlar alohida -alohida hal qilinadi, shuning uchun ularni alohida manzilli deb atashadi. LEDlar va ular oddiy RGB LED -laridan ancha qimmat.
1 -qadam: Komponentlaringizni yig'ing
Qismlarni sotib oling: ARDUINO UNO -ni sotib oling:
www.utsource.net/itm/p/7199843.html
WS2812 LEDni sotib oling:
WS2812 LED halqasini sotib oling:
www.utsource.net/itm/p/8673715.html
////////////////////////////////////////////////////////////////////////
Shunday qilib, birinchi navbatda siz ikkita muhim komponentni olishingiz kerak: ulardan biri - arduino, ikkinchisi - neopixel ws2812 svetodiodli LED / chiziqli chiziq yoki halqa.
Sotib olinadigan narsalar (sheriklik havolasi) -
Arduino Uno-
www.banggood.com/UNO-R3-ATmega16U2-AVR-Mod…
Ws2812 neopixel (12 bitli) uzuk -
www.banggood.com/3Pcs-CJMCU-12-Bit-WS2812-…
www.banggood.com/CJMCU-12-Bit-WS2812-5050-…
Ws2812 neopixel (7bit) uzuk
www.banggood.com/5Pcs-CJMCU-7-Bit-WS2812-5…
www.banggood.com/3Pcs-CJMCU-7-Bit-WS2812-5…
Ws2812 neopixel (3 bitli) uzuk -
www.banggood.com/5pcs-CJMCU-3bit-WS2812-RG…
www.banggood.com/CJMCU-3bit-WS2812-RGB-LED…
Ws2812 neopikselli chiziqli chiziq -
www.banggood.com/AUDEW-1M4M5M-RGB-SMD5050-…
www.banggood.com/4-PCS-WS2812-5V-Taillight…
www.banggood.com/0_5M1M2M3M4M5M-DC5V-USB-R…
www.banggood.com/0_5M1M2M3M4M5M-USB-RGB-50…
www.banggood.com/0_5M1M2M3M4M5M-DC5V-USB-R…
2 -qadam: ulanishlar
ulanishlar juda oddiy, faqat nima qilish kerak - vc neopixelni +5v va Gnd neopikseliga Gnd va neopikselning Vin piniga har qanday raqamli pin bilan ulash (men uni 6 -pin bilan bog'layman, chunki biz dasturiy ta'minotdagi 6 -pinni aniqlang.).
Agar aloqada muammo bo'lsa, yordam uchun videoni ko'ring.
3 -qadam: dasturlash
Arduino IDE -ni oching, keyin misollarga o'ting va "neopixel" ga o'ting, so'ng "oddiy" eskizni oching.
Eskizda siz birinchi navbatda ikkita narsani belgilashingiz kerak
1- PIN 6-ni aniqlang (neopixelning Vin-pin ulangan arduino pinini belgilashingiz kerak, biz bu erda PIN 6-dan foydalanmoqdamiz)
2- NUMPIXELS 12 ni aniqlang (siz neopikselda piksellar sonini belgilashingiz kerak, demak ularda LED yo'q, bizda 12 ta LED bor, shuning uchun biz 12 dan foydalanamiz)
Va pastadir qismida neopixel rangini sozlash uchun bitta buyruq ishlatiladi
piksel.setPixelsColor (i, piksellar. Color (r, g, b));
Bu erda "i" har qanday rangda yoqmoqchi bo'lgan piksellar sonini ko'rsatadi
& "r" "g" "b" - qizil, yashil, ko'k ranglarning soyalari va ularning qiymati 0 dan 255 gacha.
Shunday qilib, biz bu erda foydalanamiz
piksel.setPixelsColor (0, piksel. Color (0, 0, 255);
Bu shuni anglatadiki, birinchi piksel ko'k rang uchun o'rnatiladi.
4 -qadam: Kodni yuklang
Oxirgi qadam - bu kodni Arduino -ga yuklash va siz tugatdingiz va agar siz hamma narsani to'g'ri bajargan bo'lsangiz, neopixel siz bergan mantiqqa muvofiq yoqiladi.
Va agar biron bir qadam bilan bog'liq muammolar bo'lsa, iltimos, videoga qarang.
Neopikseldan zavqlaning.