You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
647 B
C++

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;
}
}