Finally got the code right. All inputs are now correctly listed up and switched.
".....
char no0[] = "SPDIF1";
char no1[] = "SPDIF2";
char no2[] = "SPDIF3";
char no3[] = "SPDIF4";
char no4[] = "I2S ";
char no5[] = "S.P.T.";
......"
".....
#define muxpinA 6 // Pin used to switch the S0 terminal on mux modules
#define muxpinB 7 // Pin used to switch the S1 terminal on mux modules
#define B3sepin 8 // Pin used to switch the B3se / Otto 2 (B2)
#define SIDECARPIN 9 // Pin used to switch the relays on the sidecar for S.P.T.
.....".
".....
pinMode(SIDECARPIN, OUTPUT); // pin for switching between PCM/DSD or S/PDIF
pinMode(B3sepin, OUTPUT); // pin for switching between PCM/DSD and SPDIF input on B3se / B2+Otto2
pinMode(muxpinA, OUTPUT); // pin for switching mux S0
pinMode(muxpinB, OUTPUT); // pin for switching mux S1
...."
"....
switch (value){
case 0:
lcd.print(no0);
digitalWrite(SIDECARPIN, HIGH);
digitalWrite(muxpinA, LOW);
digitalWrite(muxpinB, LOW);
digitalWrite(B3sepin, LOW);
break;
case 1:
lcd.print(no1);
digitalWrite(SIDECARPIN, HIGH);
digitalWrite(muxpinA, LOW);
digitalWrite(muxpinB, HIGH);
digitalWrite(B3sepin, LOW);
break;
case 2:
lcd.print(no2);
digitalWrite(SIDECARPIN, HIGH);
digitalWrite(muxpinA, HIGH);
digitalWrite(muxpinB, LOW);
digitalWrite(B3sepin, LOW);
break;
case 3:
lcd.print(no3);
digitalWrite(SIDECARPIN, HIGH);
digitalWrite(muxpinA, HIGH);
digitalWrite(muxpinB, HIGH);
digitalWrite(B3sepin, LOW);
break;
case 4:
lcd.print(no4);
digitalWrite(SIDECARPIN, HIGH);
digitalWrite(muxpinA, LOW);
digitalWrite(muxpinB, LOW);
digitalWrite(B3sepin, HIGH);
break;
case 5:
lcd.print(no5);
digitalWrite(SIDECARPIN, LOW);
digitalWrite(muxpinA, LOW);
digitalWrite(muxpinB, LOW);
digitalWrite(B3sepin, LOW);
break;
...."
Note that I have connected the analog output of the IVY to the PCM/DSD.1 side of the sidecars in order for it to be set to the surround preamp when the dac is off (the relays not energized). That is the same thing that happen when I select the last input. So each input selection starts with turning on the sidecars.
But this is the old way of doing things. I am fairly sure that Corpius and other code masters can make code that is far more elegant then this.
Edited by user Wednesday, December 23, 2015 9:41:31 AM(UTC)
| Reason: Not specified