I've been writing a piece of code to change the behaviour of an audio switch which includes muting.
It is essential that the mute circuit is driven HIGH while the relay switches, and for my first mode in the example the relay must be starting LOW.
When running the code, the mute circuit will not stop blinking, however I want it to only run once upon mode change. Any suggestions? Thanks
//this is fine as the mode changes and the relay is driven LOW to prepare for input.
if ((position1 == LOW) && (position2 == HIGH) && (position3 == HIGH)){
mode1();
digitalWrite(relay, LOW);}
//this is not, as the relay requires the mute circuit to switch but will not stop blinking.
if ((position1 == LOW) && (position2 == HIGH) && (position3 == HIGH)){
mode1();
digitalWrite(mute, HIGH);
delay(30);
digitalWrite(relay, LOW);
delay(30);
digitalWrite(mute, LOW);}