-
Notifications
You must be signed in to change notification settings - Fork 4
/
Fireworks.h
41 lines (37 loc) · 1.18 KB
/
Fireworks.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef Fireworks_h
#define Fireworks_h
#include <Arduino.h>
#include <FastLED.h>
#include "Fx.h"
#include "AudioSensor.h"
#include "AudioTrigger.h"
#include "HarmonicMotion.h"
#include "State.h"
#include "Timer.h"
class Fireworks : public Fx {
private:
// const CRGBPalette16 PALETTE = CRGBPalette16(CRGB::Blue, CRGB::Red, CRGB::Gold);
const CRGBPalette16 PALETTE = CRGBPalette16(CRGB::Red, CRGB::Gold, CRGB::Red, CRGB::Blue);
static const uint8_t ITEMS = 4;
static const uint8_t FADE_RATE = 5;
static const uint16_t DECAY_RATE = 5;
static const uint16_t DECAY_DELAY = 500;
static const uint16_t INHIBIT_DELAY = 250;
struct Item {
HarmonicMotion ball;
elapsedMillis timer;
uint8_t decay;
};
AudioTrigger *audioTrigger;
Item items[ITEMS];
uint8_t nextItem = 0;
Timer fadeTimer = Timer(10);
Timer inhibitTimer = Timer(INHIBIT_DELAY);
void randomizeItem(Item &item, double strength);
public:
Fireworks(Strip *strip, AudioChannel *audioChannel, State *state);
~Fireworks();
void loop();
void reset();
};
#endif