These are chat archives for Makuna/NeoPixelBus

14th
Sep 2016
Mehrdad K
@mkeyno
Sep 14 2016 19:18
dear @Makuna first of all , thanks for merge new HW SPI feature , but still confuse with NeoPixelAnimator object , I'm on the NeoPixelBitmap.ino example and change animation parameters , but nothings change , I think it should the POV example that need rotated line
when we really need the NeoPixelAnimator object? I mean if I want the simple rainbow effect I could just change hue of RgbColor object and in loop have only hue++
how could I enhance my effect with NeoPixelAnimator object
you may know about FastLED pallet object which is easily can define any pattern and add it to strip , do you have any similar way
Michael Miller
@Makuna
Sep 14 2016 22:25
@mkeyno The NeoPixelAnimator is a method to replace the boiler plate code everyone uses in their loop to manage time and progress through an animation. It keeps track of time and progress for you. When you start to have more than one animation running at once it is very helpful in simplifying and abstracting the code to just what is needed (applying the animation to pixels).
Michael Miller
@Makuna
Sep 14 2016 22:36
@mkeyno I am not sure what their palette feature does; as my experience with the term palette and its use with animations and colors does not match what they are doing so I dismissed it as being a incorrect use of a common use term and feature.
If a pattern is what you want, that I support and it has nothing to do with the term "palette". Generally a pattern of "colors" is called a "Sprite" (see cell animation techniques). This sprite can be one pixel in height (if you are just using a strip of neopixels this is great) or it can be multiple lines in height (great for matrix of pixels). See NeoVerticalSpriteSheet which contains a vertical oriented sprite sheet (meaning, that if a single sprite is 1 pixel in height, and the sprite sheet contains 16 sprites, then the sprite sheet image is 16 pixels in height); and it allows to Blit (render) a sprite by providing a sprite index that will then update the NeoPixelBus. See NeoPixelBufferCylon sample
Michael Miller
@Makuna
Sep 14 2016 22:41

@mkeyno On the subject of the NeoPixelAnimator, the common Arduino code in the loop is something like ...

   //do something
  delay(100);
  // so something else
  delay(100);

I hate the use of 'delay()' except in the most simple code examples. It leads to problems with more complex project real quickly. The solution to stop these blockages in 'delay()' is usually something like...

static uint32_t lastTimeIDidOneThing = millis();
static uint32_t lastTimeIDidTwoThing = millis();
uint32_t time = millis();

if (time - lastTimeIDidOneThing > 5000) {// five seconds
 // do one thing 
 lastTImeIDidOneThing = time;
}
if (time - lastTimeIDidTwoThing > 300) {// 300 milliseconds
 // do two thing 
 lastTImeIDidTwoThing = time;
}

Which is basically what the core of the AnimationManager does. If you don't wan the progress value but want more raw time values; then look at my other library Task.

Michael Miller
@Makuna
Sep 14 2016 22:53
And the NeoPixelBufferCyclon example would be a great case to use Task instead (as it cares nothing about the progress value); but I don't want to put a dependency between libraries.