Hello, Hope everyone is having a great weekend. First time poster. I am new to coding and have my 5m WS2818 up and running with a 5v 10 amp power supply and an arduino uno. I have Fastled First light running on it. My question is right now first light only lights up one led as it shoots down the string. What if i wanted to elongate from a single LED to say 5 leds shooting down the strip. Where in the code would I make that change? I have played with some of the codes where I can an it just changes where the LED starts its position? Thanks for any help.
Christopher
marmil
(Marc Miller)
September 9, 2017, 6:53pm
2
Welcome to the FastLED G+ group @Christopher_Devereux . To light up more then one LED you’ll need to modify the code to assign some color/brightness to additional pixels before calling FastLED.show(). Here’s some examples to give you some ideas to explore.
//***************************************************************
// Three moving pixels example
// Uses modulo, %, to make pixel position "loop" around and
// stay in valid pixel range.
//
// Marc Miller, Feb 2015. Updated Jan 2016.
//***************************************************************
#include "FastLED.h"
#define LED_TYPE NEOPIXEL // Strip type: NEOPIXEL, APA102, LPD8806, etc.
#define DATA_PIN 6
//#define CLOCK_PIN 13
#define NUM_LEDS 12
//#define COLOR_ORDER BGR
#define MASTER_BRIGHTNESS 100 // Master brightness (Range is 0-255)
CRGB leds[NUM_LEDS];
int16_t positionRed = 0; // Set initial start position of Red pixel
int16_t positionWhite = 4; // Set initial start position of White pixel
This file has been truncated. show original
//***************************************************************
// Marquee fun (v3)
// Pixel position down the strip comes from this formula:
// pos = spacing * (i-1) + spacing
// i starts at 0 and is incremented by +1 up to NUM_LEDS/spacing.
//
// Marc Miller, May 2016
// Updated June 2018 - reordered some stuff and small bug fix.
//***************************************************************
#include "FastLED.h"
#define LED_TYPE LPD8806
#define NUM_LEDS 32
#define COLOR_ORDER GRB
//#define LED_TYPE APA102
//#define NUM_LEDS 39
//#define COLOR_ORDER BGR
#define DATA_PIN 11
This file has been truncated. show original
//***************************************************************
// rotating beacon for lighthouse emulation, Anti-aliased version
// Marc Miller, Nov 2015
//
//Based on Mark Kriegsman's Anti-aliased light bar example here:
//http://pastebin.com/yAgKs0Ay#
//***************************************************************
#include "FastLED.h"
#define LED_TYPE NEOPIXEL
#define DATA_PIN 6
//#define CLOCK_PIN 13
#define NUM_LEDS 12
//#define COLOR_ORDER GRB
#define BRIGHTNESS 255
CRGB leds[NUM_LEDS];
int8_t hue = 42; // Light color
int8_t sat = 190; // Saturation
int8_t val = BRIGHTNESS; // Max brightness of light
This file has been truncated. show original
/* aanimations
*
* By: Can't recall where I found this.
*
* Modified by: Andrew Tuline
*
* Date: January, 2017
*
* This sketch demonstrates how to blend between two animations running at the same time.
*
*/
#include "FastLED.h" // FastLED library.
#if FASTLED_VERSION < 3001000
#error "Requires FastLED 3.1 or later; check github for latest code."
#endif
#define LED_DT 12 // Data pin to connect to the strip.
#define LED_CK 11 // Clock pin for WS2801 or APA102.
This file has been truncated. show original
Nevermind, I found the code I was looking for and added it to the example. Thanks
marmil
(Marc Miller)
September 9, 2017, 6:57pm
4