This repository has been archived by the owner on Oct 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathruum42LEDs.ino
105 lines (94 loc) · 2.21 KB
/
ruum42LEDs.ino
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
#include<FastLED.h>
#define NUM_LEDS 135
int OnSwitch = 3;
static uint8_t hue;
CRGBArray<NUM_LEDS> leds;
void setup() {
FastLED.addLeds<NEOPIXEL, 5>(leds, NUM_LEDS);
pinMode(OnSwitch, INPUT_PULLUP);
}
void loop() {
if (digitalRead(OnSwitch) == LOW) {
farbe(1000, 10);
rainbow(100, 10);
richtng(2, 20, 4);
richtng(5, 5, 30);
richtng2(4, 10, 1);
richtng2(4, 20, 80);
richtng(4, 20, 1);
snake(1, 30, 4);
snake(2, 2, 80);
snake(2, 10, 4);
snake(4, 30, 4);
}
else {
leds.fadeToBlackBy(255);
FastLED.show();
delay(100);
}
}
void snake(int durchlauf, int zeit, int aus) {
int anzahl = 0;
do {
++anzahl;
for (int i = 0; i < NUM_LEDS; i++) {
leds.fadeToBlackBy(aus);
leds[i] = CHSV(hue++, 255, 255);
FastLED.show();
if (digitalRead(OnSwitch) == HIGH) return;
delay(zeit);
}
} while (anzahl < durchlauf);
}
void richtng2(int durchlauf, int zeit, int aus) {
int anzahl = 0;
do {
++anzahl;
for (int i = 0; i < NUM_LEDS / 2; i++) {
leds.fadeToBlackBy(aus);
leds[i] = CHSV(hue++, 255, 255);
leds[i + NUM_LEDS / 2] = CHSV(hue++, 255, 255);
FastLED.show();
if (digitalRead(OnSwitch) == HIGH) return;
delay(zeit);
}
} while (anzahl < durchlauf);
}
void richtng(int durchlauf, int zeit, int aus) {
int anzahl = 0;
do {
++anzahl;
for (int i = 0; i < NUM_LEDS / 2; i++) {
leds.fadeToBlackBy(aus);
leds[i] = CHSV(hue++, 255, 255);
leds[NUM_LEDS - 5 - i] = CHSV(hue++, 255, 255);
FastLED.show();
if (digitalRead(OnSwitch) == HIGH) return;
delay(zeit);
}
} while (anzahl < durchlauf);
}
void farbe(int durchlauf, int zeit) {
int anzahl = 0;
int color = 40;
do {
++anzahl;
++color;
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CHSV(color, 255, 255);
}
FastLED.show();
if (digitalRead(OnSwitch) == HIGH) return;
delay(zeit);
} while (anzahl < durchlauf);
}
void rainbow(int durchlauf, int zeit) {
int anzahl = 0;
do {
++anzahl;
fill_rainbow(leds, NUM_LEDS, --hue + 5, 5);
FastLED.show();
if (digitalRead(OnSwitch) == HIGH) return;
delay(zeit);
} while (anzahl < durchlauf * 10);
}