-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathneopixel.cpp
More file actions
28 lines (25 loc) · 761 Bytes
/
neopixel.cpp
File metadata and controls
28 lines (25 loc) · 761 Bytes
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
#include "neopixel.h"
COLOR NEOPIXEL::wheel(uint8_t wheel_pos) {
wheel_pos = 255 - wheel_pos;
if(wheel_pos < 85) {
return Color(255 - wheel_pos * 3, 0, wheel_pos * 3);
}
if (wheel_pos < 170) {
wheel_pos -= 85;
return Color(0, wheel_pos * 3, 255 - wheel_pos * 3);
}
wheel_pos -= 170;
return Color(wheel_pos * 3, 255 - wheel_pos * 3, 0);
}
COLOR NEOPIXEL::lightWheel(uint8_t wheel_pos) {
wheel_pos = 255 - wheel_pos;
if(wheel_pos < 85) {
return Color(255 - wheel_pos, 255, wheel_pos * 3);
}
if (wheel_pos < 170) {
wheel_pos -= 85;
return Color(255, wheel_pos * 3, 255 - wheel_pos);
}
wheel_pos -= 170;
return Color(wheel_pos * 3, 255 - wheel_pos, 255);
}