-
Notifications
You must be signed in to change notification settings - Fork 1
/
triangle.cpp
138 lines (124 loc) · 3.42 KB
/
triangle.cpp
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#include "flogl/flogl.hpp"
#include <FastLED.h>
#include <math.h>
#include <unistd.h>
float vsc = 0.5;
float hsc = 0.3;
using flogl::LED;
std::vector<LED> led_coords =
{
{ 0.000000, 15.000000, -20},
{ 0.300000, 14.500000, -20},
{ 0.600000, 14.000000, -20},
{ 0.900000, 13.500000, -20},
{ 1.200000, 13.000000, -20},
{ 1.500000, 12.500000, -20},
{ 1.800000, 12.000000, -20},
{ 2.100000, 11.500000, -20},
{ 2.400000, 11.000000, -20},
{ 2.700000, 10.500000, -20},
{ 3.000000, 10.000000, -20},
{ 3.300000, 9.500000, -20},
{ 3.600000, 9.000000, -20},
{ 3.900000, 8.500000, -20},
{ 4.200000, 8.000000, -20},
{ 4.500000, 7.500000, -20},
{ 4.800000, 7.000000, -20},
{ 5.100000, 6.500000, -20},
{ 5.400000, 6.000000, -20},
{ 5.700000, 5.500000, -20},
{ 6.000000, 5.000000, -20},
{ 6.300000, 4.500000, -20},
{ 6.600000, 4.000000, -20},
{ 6.900000, 3.500000, -20},
{ 7.200000, 3.000000, -20},
{ 7.500000, 2.500000, -20},
{ 7.800000, 2.000000, -20},
{ 8.100000, 1.500000, -20},
{ 8.400000, 1.000000, -20},
{ 8.700000, 0.500000, -20},
{ 9.000000, 0.000000, -20},
{ 8.400000, 0.000000, -20},
{ 7.800000, 0.000000, -20},
{ 7.200000, 0.000000, -20},
{ 6.600000, 0.000000, -20},
{ 6.000000, 0.000000, -20},
{ 5.400000, 0.000000, -20},
{ 4.800000, 0.000000, -20},
{ 4.200000, 0.000000, -20},
{ 3.600000, 0.000000, -20},
{ 3.000000, 0.000000, -20},
{ 2.400000, 0.000000, -20},
{ 1.800000, 0.000000, -20},
{ 1.200000, 0.000000, -20},
{ 0.600000, 0.000000, -20},
{ 0.000000, 0.000000, -20},
{-0.600000, 0.000000, -20},
{-1.200000, 0.000000, -20},
{-1.800000, 0.000000, -20},
{-2.400000, 0.000000, -20},
{-3.000000, 0.000000, -20},
{-3.600000, 0.000000, -20},
{-4.200000, 0.000000, -20},
{-4.800000, 0.000000, -20},
{-5.400000, 0.000000, -20},
{-6.000000, 0.000000, -20},
{-6.600000, 0.000000, -20},
{-7.200000, 0.000000, -20},
{-7.800000, 0.000000, -20},
{-8.400000, 0.000000, -20},
{-9.000000, 0.000000, -20},
{-8.700000, 0.500000, -20},
{-8.400000, 1.000000, -20},
{-8.100000, 1.500000, -20},
{-7.800000, 2.000000, -20},
{-7.500000, 2.500000, -20},
{-7.200000, 3.000000, -20},
{-6.900000, 3.500000, -20},
{-6.600000, 4.000000, -20},
{-6.300000, 4.500000, -20},
{-6.000000, 5.000000, -20},
{-5.700000, 5.500000, -20},
{-5.400000, 6.000000, -20},
{-5.100000, 6.500000, -20},
{-4.800000, 7.000000, -20},
{-4.500000, 7.500000, -20},
{-4.200000, 8.000000, -20},
{-3.900000, 8.500000, -20},
{-3.600000, 9.000000, -20},
{-3.300000, 9.500000, -20},
{-3.000000, 10.000000, -20},
{-2.700000, 10.500000, -20},
{-2.400000, 11.000000, -20},
{-2.100000, 11.500000, -20},
{-1.800000, 12.000000, -20},
{-1.500000, 12.500000, -20},
{-1.200000, 13.000000, -20},
{-0.900000, 13.500000, -20},
{-0.600000, 14.000000, -20},
{-0.300000, 14.500000, -20},
{-0.000000, 15.000000, -20}
};
CRGB* leds;
void loop();
int main()
{
leds = new CRGB[led_coords.size()];
flogl::Flogl flogl(led_coords);
CRGB* col = leds;
for (LED& led: led_coords)
{
led.color = col++;
}
do {
usleep(30000);
loop();
} while(flogl.draw());
delete[] leds;
return 0;
}
void loop()
{
static uint8_t hue = 0;
fill_rainbow(leds, led_coords.size(), hue++, 3);
}