-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlight_effects.cpp
93 lines (76 loc) · 2.46 KB
/
light_effects.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
#include "light_effects.h"
#include "helper_functions.h"
LightEffects::LightEffects(Adafruit_WS2801 lightStrip) {
strip = lightStrip;
}
void LightEffects::rainbow(uint8_t wait) {
// TODO Remove nested for loop and use the main class loop as loop to not make main loop wait for it to finish the cycle
for (int j = 0; j < 256; j++) { // 3 cycles of all 256 colors in the wheel
for (int i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel((i + j) % 255));
}
delay(wait);
}
}
void LightEffects::fixedRainbow() {
for (int i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel(i % 255));
}
}
void LightEffects::fixedColor(uint8_t r, uint8_t g, uint8_t b) {
for (int n = 0; n < strip.numPixels(); n++) {
strip.setPixelColor(n, r, g, b);
}
}
// NOTE Could be used as a notification LED
void LightEffects::singleLight(uint8_t r, uint8_t g, uint8_t b) {
fixedColor(0, 0, 0);
strip.setPixelColor(1, r, g, b);
}
void LightEffects::dim() {
for (int n = 0; n < strip.numPixels(); n++) {
// TODO First check if value when subtracted, is equal to 0 and stop. Then reduce value
// if(strip[n].getPixelColor()){
// }
}
}
void LightEffects::brighten() {
for (int n = 0; n < strip.numPixels(); n++) {
// TODO First check if value when subtracted, is equal to 255 and stop. Then increase value
}
}
void LightEffects::nextColor() {
for (int n = 0; n < strip.numPixels(); n++) {
// TODO Set as one color, then iterate through color wheel
}
}
void LightEffects::previousColor() {
for (int n = 0; n < strip.numPixels(); n++) {
// TODO Set as one color, then iterate through color wheel
}
}
void LightEffects::vivaMalta() {
for (int i = 0; i < strip.numPixels() / 2; i++) {
strip.setPixelColor(i, 255, 255, 255);
}
for (int i = strip.numPixels() / 2; i < strip.numPixels(); i++) {
strip.setPixelColor(i, 255, 0, 0);
}
}
// NOTE This mostly implies for when having split colors
void LightEffects::rotateClockwise() {
}
// NOTE This mostly implies for when having split colors
void LightEffects::rotateAnticlockwise() {
}
void LightEffects::whites(){
//TODO Go through 3 different colors of white (if possible since it's RGB)
}
void LightEffects::greenPurple(){
//TODO Half green, half purple
}
// NOTE This is mostly for notifications if going in menus or waiting for user input
void LightEffects::blink(uint8_t r, uint8_t g, uint8_t b, uint8_t delay) {
}
void LightEffects::candleLight() {
}