หากต้องการใบเสนอราคา / ใบแจ้งหนี้ ติดต่อได้ทาง LINE Official: @mikroelec |
![]() |
รหัสสินค้า | SKU-02370 |
หมวดหมู่ | LED Display / LED Controller |
ราคา | 10.00 บาท |
สถานะสินค้า | พร้อมส่ง |
ลงสินค้า | 2 ก.ค. 2566 |
อัพเดทล่าสุด | 2 ก.ค. 2566 |
จำนวน | ชิ้น |
In this example, we will power the WS2812B LED strip using Arduino’s 5v output pin. Here we are using 8 LEDs. You can power up to 10-12 LEDs using Arduino’s 5v output pin. If you want to add more LEDs you should use an external power supply.
Here you can see that we provide a 5v power to the WS2812B RGB LED strip from Arduino. We connect the Arduino’s 5v output pin to the LED strip’s 5v pin and Arduino’s ground to the strip’s ground pin. Then connect the data pin of the LED strip to Arduino pin no 3.
If you are using more than 10-12 WS2812B RGB LEDs you need to connect an external power supply. You can connect it like below.
We will use the FastLED library to control the WS2812B LED strip. You can install it manually by downloading it from the FastLED GitHub page and putting it into the Arduinos library folder. Or you can install it using the Arduino IDE’s library management page.
To open the library management window, navigate to Tools > Manage Libraries.
Wait for the library manager to load properly. Then search “fastled”. You will find a couple of entries there. Select the right library and click install.
It will install the library. Now restart the Arduino IDE to load the library properly.
After installing the library properly, upload the below code to turn on the first three LEDs.
#include <FastLED.h>
#define DATA_PIN 3
#define NUM_LEDS 8
#define BRIGHTNESS 64
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
// Define the array of leds
CRGB leds[NUM_LEDS];
#define UPDATES_PER_SECOND 100
void setup() {
FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);
FastLED.setBrightness(BRIGHTNESS);
}
void loop() {
// Turn the LED on
leds[0] = CRGB::Red;
leds[1] = CRGB::Green;
leds[2] = CRGB::Blue;
FastLED.show();
delay(10);
}
หน้าที่เข้าชม | 555,863 ครั้ง |
ผู้ชมทั้งหมด | 313,506 ครั้ง |
ร้านค้าอัพเดท | 13 ก.ย. 2568 |