Added effect "snake".

This commit is contained in:
2019-05-31 05:45:07 +02:00
parent 36663cf067
commit a2fe1461ad
5 changed files with 73 additions and 0 deletions

View File

@ -53,6 +53,9 @@
#define EFFECT_CONFETTI_PIXELS_PER_LOOP 2
#define EFFECT_SNAKE_DIRECTION_CHANGE 10
#define EFFECT_SNAKE_SLOWDOWN 2
#ifdef DEBUG
#define LOG(x) Serial.print(x);
#define LOGln(x) Serial.println(x);

21
include/effect_snake.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef effect_snake_H
#define effect_snake_H
#include "Effect.h"
#include "prototypes.h"
class SnakeEffect : public Effect {
private:
Coords coords;
uint8_t direction;
uint8_t hue;
uint8_t run;
Window window = {0, 0, LED_WIDTH, LED_HEIGHT-6};
public:
void loop();
boolean valid_position(Coords c);
Coords update_position(Coords c, uint8_t direction);
boolean can_be_shown_with_clock();
};
#endif

View File

@ -34,6 +34,11 @@ typedef struct Matrix {
double a22;
} Matrix;
typedef struct {
uint16_t x;
uint16_t y;
} Coords;
extern uint8_t baseHue;
#endif