I used to be able to make it work with this setup, which consists of an Arduino UNO and a WS2812 LED strip, but it no longer works. This is the connection diagram:
#include <FastLED.h>
#define NUM_LEDS 1
#define DATA_PIN 3
// Define the array of leds
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
}
void loop() {
// Turn the LED on, then pause
leds[0] = CRGB::Red;
FastLED.show();
delay(500);
// Now turn the LED off, then pause
leds[0] = CRGB::Black;
digitalWrite(13, LOW);
FastLED.show();
delay(500);
}
Is there anything wrong with my setup that made the strip unusable or something or is the board just dead?
I updated the diagram, and the capacitor is used to level out the power to the LED strip. I tried connecting without it and 7 first LED just turned on even when there is no data pin connected
That is a rude thing to do because it makes comments about the original diagram nonsense
Why is the capacitor in series with the 5v line ? No current will flow through it. Shouldn't the capacitor be connected across GND and 5V lines instead ?
Help! After wiring up the schematic and powering the Arduino, some of the LEDs turned on unexpectedly, and I still can't control the LED after uploading the sketch.
I've changed the code accordingly, but it still does not work.
I wonder why some of the first LEDs just start lighting up and I can't do anything about it
#include <FastLED.h>
#define NUM_LEDS 600
#define DATA_PIN 7
// Define the array of leds
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
}
void loop() {
// Turn the LED on, then pause
leds[0] = CRGB::Red;
FastLED.show();
delay(500);
// Now turn the LED off, then pause
leds[0] = CRGB::Black;
FastLED.show();
delay(500);
}
// This function runs over and over, and is where you do the magic to light
// your leds.
void loop() {
// Move a single white led
for(int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed = whiteLed + 1) {
// Turn our current led on to white, then show the leds
leds[whiteLed] = CRGB::White;
// Show the leds (only one of which is set to white, from above)
FastLED.show();
// Wait a little bit
delay(100);
// Turn our current led back to black for the next loop around
leds[whiteLed] = CRGB::Black;
}
}
#include <FastLED.h>
#define NUM_LEDS 600
#define DATA_PIN 7
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical
fill_solid(leds, NUM_LEDS, CRGB(0, 0, 0));
FastLED.show();
}
void loop() {
// Move a single white led
for(int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed = whiteLed + 1) {
// Turn our current led on to white, then show the leds
leds[whiteLed] = CRGB::White;
// Show the leds (only one of which is set to white, from above)
FastLED.show();
// Wait a little bit
delay(100);
// Turn our current led back to black for the next loop around
leds[whiteLed] = CRGB::Black;
}
}
This is my actual wiring. The data pin is 7, and I used the above schematic with a flipped capacitor. Is anything wrong with my setup