Stap 5:
Arduino code:
/*
*/
Const int ledPins [] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; verschillende ledpins
variabelen
int connectionState [] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; schakelaar uit
VOID Setup {}
pinMode (A0, INPUT);
pinMode (A1, INPUT);
pinMode (A2, INPUT);
pinMode (A3, INPUT);
pinMode (A4, INPUT);
pinMode (A5, INPUT);
pinMode (A6, INPUT);
pinMode (A7, INPUT);
pinMode (A8, INPUT);
pinMode (A9, INPUT);
pinMode (A10, INPUT);
pinMode (A11, INPUT);
pinMode (A12, INPUT);
pinMode (A13, INPUT);
pinMode (A14, INPUT);
for (int i = 0; ik < 18; i ++) {}
pinMode (ledPins [i], OUTPUT);
}
Serial.begin(9600);
}
Arduino 2
for (int i = 0; ik < 6; i ++) {}
int. temp = analogRead(i);
Serial.Print("analog1");
Serial.println(i);
Serial.printl(temp);
// }
void loop {}
Haal waarde op van switchPin1
connectionState [0] = analogRead(A0);
connectionState [1] = analogRead(A1);
connectionState [2] = analogRead(A2);
connectionState [3] = analogRead(A3);
connectionState [4] = analogRead(A4);
connectionState [5] = analogRead(A5);
connectionState [6] = analogRead(A6);
connectionState [7] = analogRead(A7);
connectionState [8] = analogRead(A8);
connectionState [9] = analogRead(A9);
connectionState [10] = analogRead(A10);
connectionState [11] = analogRead(A11);
connectionState [12] = analogRead(A12);
connectionState [13] = analogRead(A13);
connectionState [14] = analogRead(A14);
for (int i = 0; ik < 18; i ++) {}
Als (connectionState [i] > 4) {}
connectionState [i] = 1000 + i;
Als (ik < 6) {}
Serial.Print("Drum");
Serial.Print(i);
Serial.Print("");
Serial.println(connectionState[i]);
} else if (ik > 5 & & ik < 12) {}
Serial.Print("synth");
Serial.Print(i);
Serial.Print("");
Serial.println(connectionState[i]);
} else if (ik > 11 & & ik < 18) {}
Serial.Print("string");
Serial.Print(i);
Serial.Print("");
Serial.println(connectionState[i]);
}
delay(300);
digitalWrite (ledPins [i], hoge);
}
}
}