Mundarija:

M5stick-C bilan Neopixel Ws2812 kamalakli LED yoritgichi - Arduino IDE yordamida M5stack M5stick C yordamida Neopixel Ws2812 da kamalakni ishga tushirish: 5 qadam
M5stick-C bilan Neopixel Ws2812 kamalakli LED yoritgichi - Arduino IDE yordamida M5stack M5stick C yordamida Neopixel Ws2812 da kamalakni ishga tushirish: 5 qadam

Video: M5stick-C bilan Neopixel Ws2812 kamalakli LED yoritgichi - Arduino IDE yordamida M5stack M5stick C yordamida Neopixel Ws2812 da kamalakni ishga tushirish: 5 qadam

Video: M5stick-C bilan Neopixel Ws2812 kamalakli LED yoritgichi - Arduino IDE yordamida M5stack M5stick C yordamida Neopixel Ws2812 da kamalakni ishga tushirish: 5 qadam
Video: Обзор модулей M5Stack серии M5Stick 2024, Noyabr
Anonim
Image
Image

Assalomu alaykum bolalar, biz ko'rsatmalarni o'qiymiz, biz wu2812 neopixelli LEDlarni, LED chizig'ini yoki LED matritsasini yoki m5stack m5stick-C Arduino IDE bilan ishlaydigan halqadan foydalanishni o'rganamiz va biz u bilan kamalak naqshini yasaymiz.

1 -qadam: Sizga kerak bo'lgan narsalar

Sizga kerak bo'lgan narsalar
Sizga kerak bo'lgan narsalar
Sizga kerak bo'lgan narsalar
Sizga kerak bo'lgan narsalar
Sizga kerak bo'lgan narsalar
Sizga kerak bo'lgan narsalar

Bu ko'rsatmalarni bajarish uchun bizga quyidagilar kerak: m5stack m5stick-C ishlab chiqarish kartasi C tipidagi usb kabeli

2 -qadam: Arduino IDE -ga ESP32 taxtalarini o'rnating

Arduino IDE uchun ESP32 taxtalarini o'rnating
Arduino IDE uchun ESP32 taxtalarini o'rnating

Arduino IDE -ga ESP32 taxtalarini o'rnatganingizga ishonch hosil qiling va bunday bo'lmasa, iltimos, quyidagi ko'rsatmalarga amal qiling: ESP32 BOARDS INSTALL:

3 -qadam: O'chirish

O'chirish
O'chirish
O'chirish
O'chirish
O'chirish
O'chirish

Hozirgi qism juda oddiy: Neopikseldagi Din pimi m5stick-C-dagi G26-pinga o'tadi va neopixelning Vcc/Vin-ga 5v kerak bo'ladi, shuning uchun ba'zi quvvat manbalaridan 5v-ni oling. 5v quvvati va neopixelning Gnd pimi ham umumiy asosni ta'minlash uchun m5stick-C gnd piniga ulanadi, boshqacha qilib aytganda, kontaktlarning zanglashiga olib kelishi mumkin (aytaylik, agar sizning m5stick-C batareyangiz zaryadsizlangan bo'lsa): bu holda siz ulashingiz mumkin. 5v quvvat manbai 5v/Vcc pinli Vcc/Vin pinli neopixel va 5v pinli m5stick-C, shuningdek, bu quvvat manbai gn pin neopixel gnd va m5stick-C kartasining gnd ga ulanadi. M5stick-C ishlab chiqarish kartasining G26-ga o'tadi, agar siz muammoga duch kelsangiz, ma'lumot olish uchun simli ulanish rasmlariga murojaat qiling. 5V shaharni elektr tarmog'iga ulash uchun men Arduino Vin pin & Gnd pinini ishlataman, chunki arduino usb kabelidan quvvat oladi. Quvvat bankiga ulangan. Eslatma: agar siz arduino -dan foydalanayotgan bo'lsangiz va uni 5V dan yuqori quvvat bilan quvvatlasangiz Vin pinidan foydalanmang, faqat arduino 5v manbadan quvvat olayotgan bo'lsa, Vin pinidan foydalaning, aks holda Vin pin o'rniga Vcc pinidan foydalaning.

4 -qadam: Kodni yuklash

Kod yuklanmoqda
Kod yuklanmoqda
Kod yuklanmoqda
Kod yuklanmoqda

Kodni yuklashdan oldin, Arduino IDE-ga FastLED kutubxonasini o'rnatganingizga ishonch hosil qiling, iltimos, iltimos, quyidagi kodni ko'chiring va Arduino IDE yordamida m5stick-c ishlab chiqish kartangizga yuklang.: Kodni yuklamasdan oldin, siz neopikselli LEDlar sonini kiritganingizga ishonch hosil qiling, chunki men 64 LEDni kiritganman, chunki menda neopiks matritsasida 64 ta LED bor./* Iltimos, avval FastLED kutubxonasini o'rnating. Arduino kutubxonasida FastLED */#qidiruvini boshqaring#"M5Stack.h" ni o'z ichiga oladi#"FastLED.h" ni qo'shing#Neopixel_PIN 26 ni belgilang // raqamni kiriting. LEDlarning neopikselida#ta aniq NUM_LEDS 64CRGB LED [NUM_LEDS]; uint8_t gHue = 0; statik TaskHandle_t FastLEDshowTaskHandle = 0; statik TaskHandle_t userTaskHandle = 0; void setup () {Serial.begin (115); M5.begin (); M5. Lcd. aniq (Qora); M5. Lcd.setTextColor (SARI); M5. Lcd.setTextSize (2); M5. Lcd.setCursor (40, 0); M5. Lcd.println ("Neopikselli misol"); M5. Lcd.setTextColor (oq); M5. Lcd.setCursor (0, 25); M5. Lcd.println ("Kamalak effektini ko'rsatish"); // Neopixelni ishga tushirish FastLED.addLeds (leds, NUM_LEDS).setCorrection (TypicalLEDStrip); FastLED.setBrightness (10); xTaskCreatePinnedToCore (FastLEDshowTask, "FastLEDshowTask", 2048, NULL, 2, NULL, 1);} void loop () {} void FastLEDshowESP32 () {if (userTaskHandle == 0) {userTaskHandle = xTaskHandle = xTent xTaskNotifyGive (FastLEDshowTaskHandle); const TickType_t xMaxBlockTime = pdMS_TO_TICKS (200); ulTaskNotifyTake (pdTRUE, xMaxBlockTime); userTaskHandle = 0; }} void FastLEDshowTask (void *pvParameters) {for (;;) {fill_rainbow (leds, NUM_LEDS, gHue, 7); // kamalak effekti FastLED.show (); // neopikselning EVERY_N_MILLISECONDS (20) kuchga kirishi uchun bajarilishi kerak {gHue ++; }}}

5 -qadam: Neopixel LEDidagi kamalak

Image
Image
Neopixel LED -da kamalak
Neopixel LED -da kamalak

Shunday qilib, kodni yuklagandan so'ng, siz mening neopikselli LED matritsamda kamalak naqshini ko'rishingiz mumkin va u siz uchun neopikselli chiziqli tasma/matritsa/halqa uchun paydo bo'ladi. Iltimos, harakatda ishlashini ko'rish uchun videoga qarang.

Tavsiya: