Helloo all help if anyone can ?? i am making a strip been at it a few days now, love the fadetoblackby effect got it going and all ok but need to adjust its start and stop point then move on to another part of code, used Neo pixel also but just pulling my hair out trying to sort it.
need to have clear strip set of 6 white led move to a set pint with a tail and fade at the end.
set point to be statci diffrent colourdlights then wite trail to move on again to final set of red lights.
attached both codes one is fast led just test the other is the main game.
any help would be fantastic.
cheers
Rob
#include <FastLED.h>
#define NUM_LEDS 60
#define DATA_PIN 6 //How boring and obvious!
#define COLOR_ORDER GRB //Green (G), Red (R), Blue (B)
#define CHIPSET WS2812B
#define BRIGHTNESS 60
#define VOLTS 5
#define MAX_AMPS 500 //value in milliamps
//ENOUGH NONSENSE!
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<CHIPSET,DATA_PIN,COLOR_ORDER>(leds,NUM_LEDS);
FastLED.setMaxPowerInVoltsAndMilliamps(VOLTS,MAX_AMPS);
FastLED.setBrightness(BRIGHTNESS);
FastLED.clear();
FastLED.show();
//JONNY FIVE IS ALIVE!!!!!!!!!!!!!!!!!!!!
}
void loop() {
fadeToBlackBy(leds, NUM_LEDS, 4); // Smaller value = longer tail
int i = (millis()/40) % NUM_LEDS; // How fast it goes.
leds[i] = CRGB::White;
FastLED.show();
}
code for neo pixel works just want the white line to be a trail not a static strip fill.
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif
#define LED_PIN 6
#define LED_COUNT 110
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
// constants won't change. They're used here to set pin numbers:
const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
// These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
// Any other board, you can remove this part (but no harm leaving it):
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
// END of Trinket-specific code.
strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
strip.show(); // Turn OFF all pixels ASAP
strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)
delay(120);
}
void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
strip.clear();
strip.show();
//White to Orange stripe
colorWipe(strip.Color(255, 255, 255), 50); // Red
//Orange stripe
colorWipe2(strip.Color(255, 102, 0), 50); // Red
//Orange Flash
strip.fill(0x00FF6600, 33, 7);
strip.show();
delay(+300);
strip.fill(0x00000000, 33, 7);
strip.show();
delay(+200);
strip.fill(0x00FF6600, 33, 7);
strip.show();
delay(+100);
strip.fill(0x00000000, 33, 7);
strip.show();
delay(+100);
strip.fill(0x00FF6600, 33, 7);
strip.show();
delay(+800);
colorWipeblack1(strip.Color( 0, 0, 0), 10);
//White Strip to END
colorWipe3(strip.Color( 255, 255, 255), 10); // Green
//RED Crash flash
strip.fill(0x00FF0606, 103, 7);
strip.show();
delay(+200);
strip.fill(0x00000000, 103, 7);
strip.show();
delay(+300);
strip.fill(0x00FF0606, 103, 7);
strip.show();
delay(+500);
strip.fill(0x00000000, 103, 7);
strip.show();
delay(+500);
strip.fill(0x00FF0606, 103, 7);
strip.show();
delay(+500);
strip.fill(0x00000000, 103, 7);
strip.show();
delay(+500);
strip.fill(0x00FF0606, 103, 7);
strip.show();
delay(+1200);
colorWipeblack2(strip.Color( 0, 0, 0), 10);
delay(+2000);
// Black clear the road !! END
colorWipeblack3(strip.Color( 0, 0, 0), 10); // Green
strip.fill(0x00000000, 40, 5);
} else {
strip.clear();
strip.show();
///DEMO 1
colorWipeDEMO(strip.Color( 255, 255, 255), 90); // White
colorWipeDEMO2(strip.Color( 0, 190, 40), 10); // Green
strip.fill(0x0000BC26, 67, 7);
strip.show();
delay(+100);
strip.fill(0x00000000, 67, 7);
strip.show();
delay(+100);
strip.fill(0x0000BC26, 67, 7);
strip.show();
delay(+200);
strip.fill(0x00000000, 67, 7);
strip.show();
delay(+100);
strip.fill(0x0000BC26, 67, 7);
strip.show();
delay(+2000);
colorWipeDEMO3(strip.Color( 0, 0, 0), 10); // Black
}
}
//White to Orange stripe
void colorWipe(uint32_t color, int wait) {
for(int i=0; i<strip.numPixels() -77; i++) { // For each pixel in strip...
strip.setPixelColor(i, color); // Set pixel's color (in RAM)
strip.show(); // Update strip to match
delay(wait=40); // Pause for a moment
}
}
//Orange stripe
void colorWipe2(uint32_t color, int wait) {
for(int i=33; i<strip.numPixels() -73; i++) { // For each pixel in strip...
strip.setPixelColor(i, color); // Set pixel's color (in RAM)
strip.show(); // Update strip to match
delay(wait=120); // Pause for a moment
}
}
//Black 1 stripe
void colorWipeblack1(uint32_t color, int wait) {
for(int i=0; i<strip.numPixels() -77; i++) { // For each pixel in strip...
strip.setPixelColor(i, color); // Set pixel's color (in RAM)
strip.show(); // Update strip to match
delay(wait=80); // Pause for a moment
}
}
//White Strip to END
void colorWipe3(uint32_t color, int wait) {
for(int i=40; i<strip.numPixels() -7; i++) { // For each pixel in strip...
strip.setPixelColor(i, color); // Set pixel's color (in RAM)
strip.show(); // Update strip to match
delay(wait=70); // Pause for a moment
}
}
//Black 2 stripe
void colorWipeblack2(uint32_t color, int wait) {
for(int i=40; i<strip.numPixels() -7; i++) { // For each pixel in strip...
strip.setPixelColor(i, color); // Set pixel's color (in RAM)
strip.show(); // Update strip to match
delay(wait=30); // Pause for a moment
}
}
void colorWipeblack3(uint32_t color, int wait) {
for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
strip.setPixelColor(i, color); // Set pixel's color (in RAM)
strip.show(); // Update strip to match
delay(wait=120); // Pause for a moment
}
}
//Demo white
void colorWipeDEMO(uint32_t color, int wait) {
for(int i=40; i<strip.numPixels() -43; i++) { // For each pixel in strip...
strip.setPixelColor(i, color); // Set pixel's color (in RAM)
strip.show(); // Update strip to match
delay(wait=30); // Pause for a moment
}
}
//Demo Green
void colorWipeDEMO2(uint32_t color, int wait) {
for(int i=67; i<strip.numPixels() -36; i++) { // For each pixel in strip...
strip.setPixelColor(i, color); // Set pixel's color (in RAM)
strip.show(); // Update strip to match
delay(wait=30); // Pause for a moment
}
}
//Demo Blakc
void colorWipeDEMO3(uint32_t color, int wait) {
for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
strip.setPixelColor(i, color); // Set pixel's color (in RAM)
strip.show(); // Update strip to match
delay(wait=30); // Pause for a moment
}
}