-
Notifications
You must be signed in to change notification settings - Fork 4
/
Vertigo.h
37 lines (33 loc) · 936 Bytes
/
Vertigo.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
#ifndef Vertigo_h
#define Vertigo_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 Vertigo : public Fx {
private:
static const uint8_t ITEMS = 5;
static const uint8_t FADE_RATE = 50;
static const uint16_t INHIBIT_TIME_MS = 100;
struct Item {
HarmonicMotion ball;
elapsedMillis timer;
};
CRGB color;
AudioTrigger *audioTrigger;
Item items[ITEMS];
uint8_t nextItem = 0;
Timer fadeTimer = Timer(10);
Timer inhibitTimer = Timer(INHIBIT_TIME_MS);
void randomizeItem(Item &item, double strength);
public:
Vertigo(Strip *strip, AudioChannel *audioChannel, State *state, CRGB color = CRGB::Blue);
~Vertigo();
void loop();
void reset();
};
#endif