A basic sprite declaration could be:-
#define SHAPE_WIDTH 5 #define SHAPE_HEIGHT 5 const uint8_t ShapeData[] = { B8_1BIT(00100000), B8_1BIT(01110000), B8_1BIT(11111000), B8_1BIT(01110000), B8_1BIT(00100000), }; struct CRGB ColTable[1] = { CRGB(64, 128, 255) }; cLEDSprites Sprites(&leds); cSprite Shape(SHAPE_WIDTH, SHAPE_HEIGHT, ShapeData, 1, _1BIT, ColTable, ShapeData);
#define SHAPE_WIDTH 5
#define SHAPE_HEIGHT 5
const uint8_t ShapeData[] =
{
B8_1BIT(00100000),
B8_1BIT(01110000),
B8_1BIT(11111000),
};
struct CRGB ColTable[1] = { CRGB(64, 128, 255) };
cLEDSprites Sprites(&leds);
cSprite Shape(SHAPE_WIDTH, SHAPE_HEIGHT, ShapeData, 1, _1BIT, ColTable, ShapeData);
As a minimum you will need to do the following function calls to setup your sprite:-
Shape.SetPositionFrameMotionOptions(0/*X*/, 0/*Y*/, 0/*Frame*/, 0/*FrameRate*/, +1/*XChange*/, 1/*XRate*/, +1/*YChange*/, 1/*YRate*/, SPRITE_DETECT_EDGE | SPRITE_X_KEEPIN | SPRITE_Y_KEEPIN); Sprites.AddSprite(&Shape);
Shape.SetPositionFrameMotionOptions(0/*X*/, 0/*Y*/, 0/*Frame*/, 0/*FrameRate*/, +1/*XChange*/, 1/*XRate*/, +1/*YChange*/, 1/*YRate*/, SPRITE_DETECT_EDGE | SPRITE_X_KEEPIN | SPRITE_Y_KEEPIN);
Sprites.AddSprite(&Shape);
Then to display your sprite:-
FastLED.clear(); Sprites.UpdateSprites(); Sprites.RenderSprites(); FastLED.show();
FastLED.clear();
Sprites.UpdateSprites();
Sprites.RenderSprites();
FastLED.show();
There was an error while loading. Please reload this page.