int r = 13; int g = 12; int b = 11; int pot; int fsr1; int fsr2; int fsr3; int tonea; int toneb; int tonec; // notes to play, corresponding to the 3 sensors: void setup() { pinMode(r, OUTPUT); pinMode(g, OUTPUT); pinMode(b, OUTPUT); Serial.begin(9600); } void loop() { Serial.print(analogRead(0)); Serial.print(","); Serial.print(analogRead(1)); Serial.print(","); Serial.println(analogRead(2)); Serial.println(analogRead(3)); fsr1 = analogRead(0); fsr2 = analogRead(1); fsr3 = analogRead(2); pot = analogRead(3); if ((pot >=0)&&(pot<=341)) { if (fsr1 > 3) { tone(8, 82, 20); digitalWrite(r, HIGH); } else { digitalWrite(r, LOW);} if (fsr2 > 3) { tone(8, 117, 20); digitalWrite(b, HIGH); } else { digitalWrite(b, LOW);} if (fsr3 > 3) { tone(8, 78, 20); digitalWrite(g, HIGH); } else { digitalWrite(g, LOW);} } if ((pot >= 342)&&(pot<= 682)) { if (fsr1 > 3) { tone(8, 330, 20); digitalWrite(r, HIGH); } else { digitalWrite(r, LOW);} if (fsr2 > 3) { tone(8, 466, 20); digitalWrite(b, HIGH); }else { digitalWrite(b, LOW);} if (fsr3 > 3) { tone(8, 311, 20); digitalWrite(g, HIGH); } else { digitalWrite(g, LOW);} } if ((pot >= 683)&&(pot<= 1024)) { if (fsr1 > 3) { tone(8, 1319, 20); //6 notes digitalWrite(r, HIGH); } else { digitalWrite(r, LOW);} if (fsr2 > 3) { tone(8, 1865, 20); digitalWrite(b, HIGH); }else { digitalWrite(b, LOW);} if (fsr3 > 3) { tone(8, 1245, 20); digitalWrite(g, HIGH); } else { digitalWrite(g, LOW);} } Serial.println(); }