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