ungetestete Vereinfachungen

This commit is contained in:
Benedikt Elssmann 2019-12-30 12:45:58 +01:00
parent c3640c5ed4
commit bb2c6b387c

View file

@ -12,7 +12,57 @@ void setup() {
}
void loop() {
singleOn(100);
// int test[] = {I, N, K};
// order(test, 200, false);
// off();
fromLeft(100);
toRight(100);
}
void off() {
digitalWrite(L, LOW);
digitalWrite(I, LOW);
digitalWrite(N, LOW);
digitalWrite(K, LOW);
delay(1000);
}
void startLetter(int letter, int time) {
digitalWrite(letter, HIGH);
delay(2 * time);
}
void endLetter(int letter, int time) {
delay(2 * time);
digitalWrite(letter, LOW);
}
void schng(int from, int to, int time) {
delay(2 * time);
digitalWrite(to, HIGH);
delay(time);
digitalWrite(from, LOW);
delay(2 * time);
}
void order(int list[], int time, bool keepEnd) {
int length = (int) (sizeof(list) / sizeof(int));
if(length == 0) {
return;
}
startLetter(list[0], time);
for (int i = 1; i < length; i++) {
schng(list[i-1], list[i], time);
}
if(keepEnd) {
return;
}
endLetter(list[length], time);
}
void singleOn(int delayTime) {
@ -49,191 +99,171 @@ void MiamiMidnight() {
delay(900);
}
void klinik() {
digitalWrite(K, HIGH);
delay(500);
digitalWrite(L, HIGH);
delay(100);
digitalWrite(K, LOW);
delay(400);
digitalWrite(I, HIGH);
delay(100);
digitalWrite(L, LOW);
delay(400);
digitalWrite(N, HIGH);
delay(100);
digitalWrite(I, LOW);
delay(400);
digitalWrite(I, HIGH);
delay(100);
digitalWrite(N, LOW);
delay(400);
digitalWrite(K, HIGH);
delay(100);
digitalWrite(I, LOW);
delay(400);
digitalWrite(K, LOW);
void klinik(int time) {
int letters[] = {K, L, I, N, I, K};
order(letters, time, false);
delay(1000);
}
void fromLeft() {
void fromLeft(int del) {
digitalWrite(L, HIGH);
delay(500);
delay(del);
digitalWrite(I, HIGH);
delay(100);
delay(del/4);
digitalWrite(L, LOW);
delay(400);
delay(del);
digitalWrite(N, HIGH);
delay(100);
delay(del/4);
digitalWrite(I, LOW);
delay(400);
delay(del);
digitalWrite(K, HIGH);
delay(100);
delay(del/4);
digitalWrite(N, LOW);
delay(900);
delay(del*2);
digitalWrite(L, HIGH);
delay(500);
delay(del);
digitalWrite(I, HIGH);
delay(100);
delay(del/4);
digitalWrite(L, LOW);
delay(400);
delay(del);
digitalWrite(N, HIGH);
delay(100);
delay(del/4);
digitalWrite(I, LOW);
delay(900);
delay(del*2);
digitalWrite(L, HIGH);
delay(500);
delay(del);
digitalWrite(I, HIGH);
delay(100);
delay(del/4);
digitalWrite(L, LOW);
delay(900);
delay(del*2);
digitalWrite(L, HIGH);
delay(3000);
}
void fromRight() {
void fromRight(int del) {
digitalWrite(K, HIGH);
delay(500);
delay(del);
digitalWrite(N, HIGH);
delay(100);
delay(del/4);
digitalWrite(K, LOW);
delay(400);
delay(del);
digitalWrite(I, HIGH);
delay(100);
delay(del/4);
digitalWrite(N, LOW);
delay(400);
delay(del);
digitalWrite(L, HIGH);
delay(100);
delay(del/4);
digitalWrite(I, LOW);
delay(900);
delay(del*2);
digitalWrite(K, HIGH);
delay(500);
delay(del);
digitalWrite(N, HIGH);
delay(100);
delay(del/4);
digitalWrite(K, LOW);
delay(400);
delay(del);
digitalWrite(I, HIGH);
delay(100);
delay(del/4);
digitalWrite(N, LOW);
delay(900);
delay(del*2);
digitalWrite(K, HIGH);
delay(500);
delay(del);
digitalWrite(N, HIGH);
delay(100);
delay(del/4);
digitalWrite(K, LOW);
delay(900);
delay(del*2);
digitalWrite(K, HIGH);
delay(3000);
}
void toLeft() {
void toLeft(int del) {
digitalWrite(L, HIGH);
digitalWrite(I, HIGH);
digitalWrite(N, HIGH);
digitalWrite(K, HIGH);
digitalWrite(L, LOW);
delay(1000);
delay(del*2);
digitalWrite(L, HIGH);
delay(100);
delay(del/4);
digitalWrite(I, LOW);
delay(400);
delay(del);
digitalWrite(L, LOW);
delay(1000);
delay(del*2);
digitalWrite(I, HIGH);
delay(100);
delay(del/4);
digitalWrite(N, LOW);
delay(400);
delay(del);
digitalWrite(L, HIGH);
delay(100);
delay(del/4);
digitalWrite(I, LOW);
delay(400);
delay(del);
digitalWrite(L, LOW);
delay(1000);
delay(del*2);
digitalWrite(N, HIGH);
delay(100);
delay(del/4);
digitalWrite(K, LOW);
delay(400);
delay(del);
digitalWrite(I, HIGH);
delay(100);
delay(del/4);
digitalWrite(N, LOW);
delay(400);
delay(del);
digitalWrite(L, HIGH);
delay(100);
delay(del/4);
digitalWrite(I, LOW);
delay(400);
delay(del);
digitalWrite(L, LOW);
delay(3000);
}
void toRight() {
void toRight(int del) {
digitalWrite(L, HIGH);
digitalWrite(I, HIGH);
digitalWrite(N, HIGH);
digitalWrite(K, HIGH);
digitalWrite(K, LOW);
delay(1000);
delay(del*2);
digitalWrite(K, HIGH);
delay(100);
delay(del/4);
digitalWrite(N, LOW);
delay(400);
delay(del);
digitalWrite(K, LOW);
delay(1000);
delay(del*2);
digitalWrite(N, HIGH);
delay(100);
delay(del/4);
digitalWrite(I, LOW);
delay(400);
delay(del);
digitalWrite(K, HIGH);
delay(100);
delay(del/4);
digitalWrite(N, LOW);
delay(400);
delay(del);
digitalWrite(K, LOW);
delay(1000);
delay(del*2);
digitalWrite(I, HIGH);
delay(100);
delay(del/4);
digitalWrite(L, LOW);
delay(400);
delay(del);
digitalWrite(N, HIGH);
delay(100);
delay(del/4);
digitalWrite(I, LOW);
delay(400);
delay(del);
digitalWrite(K, HIGH);
delay(100);
delay(del/4);
digitalWrite(N, LOW);
delay(400);
delay(del);
digitalWrite(K, LOW);
delay(3000);
}