Page 1 of 1

How to create a static color show using arduino for ws2812b led strip?

how to create a static color show using arduino for ws2812b led strip?

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
Examples: "MacOS X - Your question", "MS Word - Your Tip or Trick".

Please note that switching to another language when reading a post will not work!
Posts will not have a translated counterpart.




RSS Feed

Home Forums Hardware Arduino how to create a static color show using arduino for ws2812b led strip?

This topic contains 3 replies, has 2 voices, and was last updated by  hans 3 years, 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • 5604

    askfriends
    Participant

    Hello;

    i want to create a static color show for my ws2812b led strip, lets suppose i want only to show red color behind my tv, so how to make sketch? please someone write and share.

    thanks

    5605

    hans
    Keymaster

    Hi AskFriends,

    (see also the Arduino LED effect article)

    When using the FastLED library, you could do something like this:

    #include "FastLED.h"
    #define NUM_LEDS 60 // Number of LEDs in your ELD strip
    CRGB leds[NUM_LEDS];
    #define PIN 6 // Arduino pin used for LED strip
    void setup()
    {
      FastLED.addLeds<WS2811, PIN, GRB>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
    }
    void loop() { 
      for(int i = 0; i < NUM_LEDS; i++ ) {
        leds[Pixel].r = 0x00; // Red
        leds[Pixel].g = 0x00; // Green
        leds[Pixel].b = 0xFF; // Blue
      }
    FastLED.show();
    }

    For AdaFruit NeoPixel library something like this:

    #include <Adafruit_NeoPixel.h>
    #define PIN 6 // Arduino PIN
    #define NUM_LEDS 60 // Number of LEDs in strip
    // Parameter 1 = number of pixels in strip
    // Parameter 2 = pin number (most are valid)
    // Parameter 3 = pixel type flags, add together as needed:
    // NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
    // NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
    // NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
    // NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
    Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);
    void setup() {
      strip.begin();
      strip.show(); // Initialize all pixels to 'off'
    }
    void loop() { 
      for(int i = 0; i < NUM_LEDS; i++ ) {
        strip.setPixelColor(Pixel, strip.Color(red, green, blue));
      }
      strip.show();
    }

    Hope this helps 

    5607

    askfriends
    Participant

    THANK YOU SO MUCH.

    5608

    hans
    Keymaster

    No problem – hope it was you were looking for 

Viewing 4 posts - 1 through 4 (of 4 total)



You must be logged in to reply to this topic.