Little Robot Friends
Arduino Library Reference
version 1.1
|
This tightly-packed data structure contains all the information required for animating colors on the LRFs RGB LED eyes. By using lookup tables for color and animation data, the entire structure takes up only 12-bits (with 4-bits reserved for future use). That means you can create a lot of different patterns without taking up a ton of precious memory. The start and target members (LRFColor) define the 'a' and 'b' values for the patterns animation (as defined by 'mode'). Creating a custom pattern looks like this:
LRFPatternStruct myPattern = { LRFColor_Red, LRFColor_Green, LRFPatternMode_Fade };
This generates a pattern where both eyes will begin as red, then fade to green over the patterns duration (which defaults to 1000ms).
A more complex pattern might be:
LRFPatternStruct myOtherPattern = { LRFColor_Red, LRFColor_Green, LRFPatternMode_FadeFlipToggle };
In this case, the left eye begins as red, the right eye begins as green, then they crossfade colors. Once the pattern completes and is reset, the start and target colors 'flip'. On the next run of that pattern the left eye will begin as green and the right eye will begin as red. And so on, and so on...
You can also set and get the values of the structure separately...
LRFColor color = myPattern.start; // copy the starting color into a local variable myPattern.start = LRFColor_Blue; // change the starting color to blue
Definition at line 129 of file LRFUtils.h.
#include <LRFUtils.h>
Public Attributes | |
LRFColor | start:4 |
Starting color. | |
LRFColor | target:4 |
Target color. | |
LRFPatternMode | mode:4 |
Animation type (perhaps 'type' would have been a better name) | |
int | reserved:4 |
Reserved for future use (or if you need some extra bits?) | |