int A; int B; int C; bool BA; bool BB; bool BC; void setup() { Serial.begin(9600); } void loop() { A = analogRead (A1); Serial.print ("A="); Serial.println (A); B = analogRead (A2); Serial.print ("B="); Serial.println (B); C = analogRead (A3); Serial.print ("C="); Serial.println (C); if (A>100 && !BA) { tone(9, 200); BA = true; } else if (A<100 && BA){ noTone(9); BA = false; } if (B>100 && !BB) { tone(9, 400); BB = true; } else if (B<100 && BB){ noTone(9); BB = false; } if (C>100 && !BC) { tone(9, 600); BC = true; } else if (C<100 && BC){ noTone(9); BC = false; } }