0
votes

I purchased a 5 meter strip of WS2812B LEDs to be used in conjunction with a motion detector (WS2812B 5 Pins RGBW RGBWW 4 IN 1 LED Strip Light Non-Waterproof DC5V).

The strips are hooked up to a 5V power supply (USB powerbank) and GND/5V/signal on pin 6 on an arduino UNO.

I should note that I so far have not cut the LED strip, so all 5 meters are intact.

  • I've tried getting the LEDs to emit simple colors using the FASTLED library using the code below. The Blue/blue/blue combination results in the colors Blue/Red/Green on LEDs 0-2 Changing to Red/Red/Red produces Yellow-ish/blue/off Changing to Green/Green/Green produces the colors Red/lightgreen-ish/off
  • I've tried shifting from RGB to RBG color scheme to no avail
  • I don't have much information on the LED strip apart from what I have already provided you with

Can you give me any ideas on how to proceed?

#include "FastLED.h"

#define NUM_LEDS 5
#define DATA_PIN 6


// Define the array of leds
CRGB leds[NUM_LEDS];

void setup()
{
  //FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);   
  FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS); // for GRB LEDs
}

void loop()
{
  leds[0] = CRGB::Blue; 
  leds[1] = CRGB::Blue;
  leds[2] = CRGB::Blue;
  FastLED.show();
  delay(500);
1

1 Answers

0
votes

This might not be the exact answer you are looking for, but I’d suggest using the Adafruit_Neopixel.h library for your LED’s. Just did a Projekt with that library and the exact LED strip you are using and it is working great so far.

#include "Adafruit_NeoPixel.h"`

#define LED_PIN     6              
#define LED_COUNT  60 
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

int red = 100;
int green = 0;
int blue = 0; 

void setup() {
strip.begin();           // INITIALIZE NeoPixel strip object (REQUIRED)
strip.show();            // Turn OFF all pixels ASAP}
}

void loop() {
for (i=0; i<LED_COUNT; i++){   
    strip.setPixelColor(i, strip.Color(Red, Green, Blue));
    strip.show();
  }  
}

This should make 60 LED’s red. I’ve also got an LED Project on my GitHub page if you want to look that up. If the code above still doesn’t work I assume your wiring is wrong. I power my chip and LEDs off a power supple and also use the ground of the power supply.