Controlling LedStrip


hi guys, first let me introduce myself, im marvin , i've been interested in leds , kind of stuff, came idea control ws2811 ledstrip visual basic program, works there's huge delay between pressing button making leds green , happening, around 1/2 seconds. there anyway cant speed up? because when use application " vixen lights" works instantly. i've added effect "fire2012" project, smooth effect. changes every 1/2 seconds to.
the rx light blinks every 1/2 seconds, , when rx light blinks, next color picked played, it's weird, cant find on internet this..

here's code:

code: [select]
#define num_leds 50
#define data_pin 6
 
//fire
#define brightness  200
#define frames_per_second 60
#define cooling  55
#define sparking 120
 
crgb leds[num_leds];
int val;
 
//fire
bool greversedirection = false;
 
bool isstrobewhiteon = false;
bool isfireon = false;
 
 
//-----------------------------------setup-----------------------------------
 
void setup()
{
  serial.begin(115200); // set serial speed
  fastled.addleds<ws2811, data_pin, rgb>(leds, num_leds);
 
  fastled.setbrightness( brightness );
}
 
 
//-------------------------------------loop-------------------------------------
 
void loop()
{
  if (serial.available() == 0);
  val = serial.parseint(); // deduct ascii value of '0' find numeric value of sent number
  {
    if (val ==  1 )
    {
      fill_solid( leds, num_leds, crgb::red);
      fastled.show();
    }
    /////////
    if (val == 2)
    {
      fill_solid( leds, num_leds, crgb::yellow);
      fastled.show();
    }
    /////////
    {
      if (val == 3 )
        fill_solid( leds, num_leds, crgb::green);
      fastled.show();
    }
    if (val == 4 )
    {
      fill_solid( leds, num_leds, crgb::orange);
      fastled.show();
    }
    /////////
    if (val == 5 )
    {
      fill_solid( leds, num_leds, crgb::purple);
      fastled.show();
    }
    /////////
 
    if (val == 6 )
    {
      fill_solid( leds, num_leds, crgb::blue);
      fastled.show();
    }
    /////////
    if (val == 7 )
    {
      fill_solid( leds, num_leds, crgb::cyan);
      fastled.show();
    }
    /////////
    if (val == 8 )
    {
      isstrobewhiteon = true;
    }
    /////////
    if (val == 9 )
    {
      isfireon = true;
    }
 
 
    serial.println(val);
 
  }
 
  if (isstrobewhiteon)
  {
    strobewhite();
  }
 
  if (isfireon)
  {
    fire2012();
    fastled.show(); // display frame
  }
 
}


functions code: (just effects)

code: [select]
void strobewhite() //wit knipperen
{
  fill_solid( leds, num_leds, crgb::white);
  fastled.show();
  delay(100);
 
  fill_solid( leds, num_leds, crgb::black);
  fastled.show();
  //delay(100);
}
 
 
void fire2012()
{
  // array of temperature readings @ each simulation cell
  static byte heat[num_leds];
 
  // step 1.  cool down every cell little
  ( int = 0; < num_leds; i++) {
    heat[i] = qsub8( heat[i],  random8(0, ((cooling * 10) / num_leds) + 2));
  }
 
  // step 2.  heat each cell drifts 'up' , diffuses little
  ( int k = num_leds - 1; k >= 2; k--) {
    heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;
  }
 
  // step 3.  randomly ignite new 'sparks' of heat near bottom
  if ( random8() < sparking ) {
    int y = random8(7);
    heat[y] = qadd8( heat[y], random8(160, 255) );
  }
 
  // step 4.  map heat cells led colors
  ( int j = 0; j < num_leds; j++) {
    crgb color = heatcolor( heat[j]);
    int pixelnumber;
    if ( greversedirection ) {
      pixelnumber = (num_leds - 1) - j;
    } else {
      pixelnumber = j;
    }
    leds[pixelnumber] = color;
  }
}




i hope can me, because i've been stuck @ 1 week now..

quote
see pastebin code...
no, can please post here on forum using code tags described in "how use forum" post.


Arduino Forum > Using Arduino > LEDs and Multiplexing > Controlling LedStrip


arduino

Comments

Popular posts from this blog

DHT11 Time out error using v0.4.1library

Sketch upload fails with Java error (___REMOVE___/bin/avrdude)!

Arduino Uno + KTY81/210 temperature sensor