These are chat archives for Makuna/NeoPixelBus

10th
Mar 2016
Stephen Hall
@stephenmhall
Mar 10 2016 20:57 UTC
My first question, just getting to grips with the library. Can someone explain how to work with multiple animations, I am using a NeoPixel 12 element ring as a diagnostic display for my heating controller, this involves the 4 cardinal pixels as status lights either green or yellow and the other 8 pixels are a heartbeat fade either red or blue depending on heating state. The lights are controlled by serial messages. I have the heartbeat working, I get 4 pulses of red or blue, I have this code to run the heartbeat
'''
Stephen Hall
@stephenmhall
Mar 10 2016 21:17 UTC

Ok I will gett he hang of this system yet. Code

  if (heatState == 1) {
    if (animations.IsAnimating()) {
      exit;
    }
    else if(heatCycle < 4){
      FadeInFadeOutRinseRepeat(0.15f, 360); // 0.0 = black, 0.25 is normal, 0.5 is bright
    }
  }

  if (heatState == 0) {
    if (animations.IsAnimating()) {
      exit;
    }
    else if(heatCycle < 4){
      FadeInFadeOutRinseRepeat(0.1f, 200); // 0.0 = black, 0.25 is normal, 0.5 is bright
    }
  }

  if (heatState == 2 && effectState == 1) {
    //Serial.println("Starting animation blue beat");
    if (animations.IsAnimating()) {
      FadeInFadeOutRinseRepeat(0.1f, 200); // 0.0 = black, 0.25 is normal, 0.5 is bright
    }
  }

  if (animations.IsAnimating())
  {
    // the normal loop just needs these two to run the active animations
    //Serial.println("update anim");
    animations.UpdateAnimations();
    strip.Show();
  }

However when I add conditions for the status lights an animation is already running so the animations do not run. How do I differentiate between animations?

Stephen Hall
@stephenmhall
Mar 10 2016 21:49 UTC
progress, I have switched to '(animations.IsAnimationActive(0))' and now my status change shows but it happens on the current running fade animation instead of just affecting the one pixel. When it has faded to green or yellow the red or blue fade continues.
Stephen Hall
@stephenmhall
Mar 10 2016 21:56 UTC
fixed, I think I just needed to talk about it :) I had not made sure all references to the animation number were the same.