-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTubes.cpp
More file actions
67 lines (51 loc) · 1.21 KB
/
Tubes.cpp
File metadata and controls
67 lines (51 loc) · 1.21 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "platform_config.h"
#include "options.h"
// #define MASTERCONTROL
#define MASTER_PIN 6
#define NUM_LEDS 64
#define USERADIO
#include "beats.h"
#include "virtual_strip.h"
#include "controller.h"
#include "master.h"
#include "radio.h"
#include "debug.h"
BeatController beats;
Radio radio;
PatternController controller(NUM_LEDS, &beats, &radio);
DebugController debug(&controller);
Master *master = NULL;
void randomize(long seed) {
for (int i = 0; i < seed % 16; i++) {
randomSeed(random());
}
random16_add_entropy( random() );
}
void setup() {
delay(2000);
Serial.begin(115200);
randomize(analogRead(0));
pinMode(MASTER_PIN, INPUT_PULLUP);
if (digitalRead(MASTER_PIN) == LOW) {
master = new Master(&controller);
master->setup();
}
// Start timing
globalTimer.setup();
beats.setup();
controller.setup(master != NULL);
debug.setup();
}
void loop()
{
EVERY_N_MILLISECONDS( 1000 ) {
randomize(random());
}
beats.update(); // ~30us
controller.update(); // radio: 0-3000us patterns: 0-3000us lcd: ~50000us
debug.update(); // ~25us
if (master)
master->update();
// Draw after everything else is done
controller.led_strip->update(master != NULL); // ~25us
}