Loading
Loading
IoT Lab content is currently available in Arabic only. We're working on an English version.
عرض بالعربية →Every LED a different color, through a single wire.
Use a high-current 5V power supply for the strip. Place a capacitor between the positive and negative of the supply. Data is connected through a 330 Ohm resistor to pin 6.
#include <FastLED.h>
#define NUM_LEDS 10
#define DATA_PIN 6
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
}
void loop() {
for(int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB::Red;
FastLED.show();
delay(50);
leds[i] = CRGB::Black;
}
}Powering a long strip with 60 or more LEDs from Arduino's 5V pin. Each LED draws 60mA — a 60-LED strip may draw 3.6A, instantly burning the Arduino or the laptop port.