Hi there,
I am new to Arduino.
I would like to use the same button (record_button) for 2 different functions.
1 - start recording
2 - stop recording
I would like to remove cutshort_button and replace it with record_button. Replacing the variable doesn't work. I have tried using flags but don't know whereabouts to put it.
Here is my code (didn't post whole lot because it is very long and messy)
if (digitalRead(record_button) == HIGH) {
digitalWrite(record_led, HIGH);
for(int i = 0; i < maxNumber ; i++) {
//code to play notes
saveSounds[saveNumber] = tone_key;
saveNumber++;
if (digitalRead(cutshort_button) == HIGH){ // I would like to remove this and use record_button
break; // instead of cutshort_button
}
}
digitalWrite(record_led, LOW);
tone(speaker, 700);
delay(200);
noTone(speaker);
}
Thanks so much in advance!