Workaround zur order (ORDER!) Funktion, Array-Länge muss mitgegeben werden.

This commit is contained in:
Benedikt Elssmann 2019-12-30 16:48:16 +01:00
parent bb2c6b387c
commit fa4c3605eb

View file

@ -12,14 +12,24 @@ void setup() {
} }
void loop() { void loop() {
// int test[] = {I, N, K}; klinik(150);
// order(test, 200, false); off();
// off(); int l1[] = {L,I,N,K};
fromLeft(100); order(l1, 4, 150, true);
toRight(100); order(l1, 3, 150, true);
order(l1, 2, 150, true);
order(l1, 1, 150, true);
off();
//fromLeft(100);
//toRight(100);
} }
void off() { void off() {
digitalWrite(L, HIGH);
digitalWrite(I, HIGH);
digitalWrite(N, HIGH);
digitalWrite(K, HIGH);
delay(200);
digitalWrite(L, LOW); digitalWrite(L, LOW);
digitalWrite(I, LOW); digitalWrite(I, LOW);
digitalWrite(N, LOW); digitalWrite(N, LOW);
@ -45,16 +55,14 @@ void schng(int from, int to, int time) {
delay(2 * time); delay(2 * time);
} }
void order(int list[], int time, bool keepEnd) { void order(int list[], int length, int time, bool keepEnd) {
int length = (int) (sizeof(list) / sizeof(int));
if(length == 0) { if(length == 0) {
return; return;
} }
startLetter(list[0], time); startLetter(list[0], time);
for (int i = 1; i < length; i++) { for (byte i = 1; i < length; i++) {
schng(list[i-1], list[i], time); schng(list[i-1], list[i], time);
} }
@ -100,8 +108,9 @@ void MiamiMidnight() {
} }
void klinik(int time) { void klinik(int time) {
int length = 6;
int letters[] = {K, L, I, N, I, K}; int letters[] = {K, L, I, N, I, K};
order(letters, time, false); order(letters, length, time, false);
delay(1000); delay(1000);
} }