Skip to content

Instantly share code, notes, and snippets.

@aaronsherwood
Created November 23, 2012 17:51
Show Gist options
  • Save aaronsherwood/4136640 to your computer and use it in GitHub Desktop.
Save aaronsherwood/4136640 to your computer and use it in GitHub Desktop.
Arduino code for the Glockentar
const int guitarPin[8] = {A0, A1, A2, A3, A4, A5, 2, 3};
const int solenoidPin[8] = {5, 6, 7, 8, 9, 10, 11, 12};
int switchState[8] = {0, 0, 0, 0, 0, 0, 0, 0};
boolean triggered[8] = {0, 0, 0, 0, 0, 0, 0, 0};
void setup() {
for (int i=0; i<8; i++) {
pinMode(guitarPin[i], INPUT);
pinMode(solenoidPin[i], OUTPUT);
digitalWrite(solenoidPin[i],HIGH);
}
Serial.begin(9600);
}
void loop(){
for (int i=0; i<8; i++) {
switchState[i] = digitalRead(guitarPin[i]);
if (switchState[i]==1) {
if (triggered[i]==0){
digitalWrite(solenoidPin[i],LOW);
Serial.write(i);
delay(100);
digitalWrite(solenoidPin[i], HIGH);
triggered[i]=1;
}
}
else {
triggered[i]=0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment