0

difficulty coding adafruit neopixel flashing dynamic car
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

difficulty coding adafruit neopixel flashing dynamic car

by guigui81 on Tue Jan 02, 2018 4:55 pm

Good evening to the community,

To begin, Happy New Year to you all!

I just discovered the beautiful world of adafruit and arduino a few weeks ago.

I can do some DIY but I'm far from what I'm trying to do!

Could someone please help me.

I want to use my neopixel RGB led strip to create a car flashing scroll like these videos.

https://youtu.be/K_3U41Ok7dc
or: https://youtu.be/CqiLsHXxZKg


For the installation in the lighthouse and arduino everything is OK, my problem is on the code.
I tried to edit with the available libraries but I can not do it.

I have 22 LEDs on each side and the flashing lights up with the + steering wheel or warnng.

Thank you very much for your help, good evening

guigui81
 
Posts: 5
Joined: Tue Jan 02, 2018 4:24 pm

Re: difficulty coding adafruit neopixel flashing dynamic car

by adafruit_support_bill on Tue Jan 02, 2018 5:22 pm

The strandtest example code includes a function called "colorWipe":
Code: Select all | TOGGLE FULL SIZE
// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);
  }
}


The first parameter is the color. For yellow, use "strip.Color(255, 255, 0)"

The second parameter is the speed. Use a number between 0 (fast) and 255 (slow) and adjust to get the speed that you need.

adafruit_support_bill
 
Posts: 70386
Joined: Sat Feb 07, 2009 10:11 am

Re: difficulty coding adafruit neopixel flashing dynamic car

by guigui81 on Tue Jan 02, 2018 6:49 pm

Thank you for the answer but I try and I do not understand!
I think I'm missing too much base to get there: ((

I've followed a lot of tutorials to understand but I can not do it

I will start again tomorrow at rest

guigui81
 
Posts: 5
Joined: Tue Jan 02, 2018 4:24 pm

Re: difficulty coding adafruit neopixel flashing dynamic car

by adafruit_support_bill on Tue Jan 02, 2018 9:32 pm

The pattern you are looking for is a simple loop, with a colorWipe in yellow followed by a colorWipe with black. Just keep repeating for the flashing effect.

adafruit_support_bill
 
Posts: 70386
Joined: Sat Feb 07, 2009 10:11 am

Re: difficulty coding adafruit neopixel flashing dynamic car

by guigui81 on Thu Jan 04, 2018 10:11 am

Thank you.

The effect is good but it does not loop.

Why ?

Thank you for your help and patience!


Code: Select all | TOGGLE FULL SIZE
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
  #include <avr/power.h>
#endif
#define PIN 2


Adafruit_NeoPixel strip = Adafruit_NeoPixel(12, PIN, NEO_GRB + NEO_KHZ800);


void setup() {
  #if defined (__AVR_ATtiny85__)
    if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
  #endif


  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop()
{

  colorWipe(strip.Color(255, 255, 0), 30);

}

void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, c);
    strip.show();
    delay(25);
  }
}

guigui81
 
Posts: 5
Joined: Tue Jan 02, 2018 4:24 pm

Re: difficulty coding adafruit neopixel flashing dynamic car

by adafruit_support_bill on Thu Jan 04, 2018 10:17 am

You are only doing the colorWipe to yellow. You need to follow that with a colorWipe to black:

Code: Select all | TOGGLE FULL SIZE
void loop()
{
  colorWipe(strip.Color(255, 255, 0), 30);  // yellow
  colorWipe(strip.Color(0, 0, 0), 30);  // black
}

adafruit_support_bill
 
Posts: 70386
Joined: Sat Feb 07, 2009 10:11 am

Re: difficulty coding adafruit neopixel flashing dynamic car

by guigui81 on Thu Jan 04, 2018 1:16 pm

it works !!! :))) Thank you very much !

guigui81
 
Posts: 5
Joined: Tue Jan 02, 2018 4:24 pm

Re: difficulty coding adafruit neopixel flashing dynamic car

by guigui81 on Thu Jan 04, 2018 1:36 pm

and do you know if I can increase the power of LEDs ?

guigui81
 
Posts: 5
Joined: Tue Jan 02, 2018 4:24 pm

Re: difficulty coding adafruit neopixel flashing dynamic car

by adafruit_support_bill on Thu Jan 04, 2018 1:50 pm

No. 255 per channel is the maximum. If you want it to be brighter, you need to use higher power LEDs like the Pixies: https://www.adafruit.com/product/2741

adafruit_support_bill
 
Posts: 70386
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.