5vdc reed relays from the shack acting strange

well, i bought those 5vdc reed relays from radioshack today becuase i couldent get 2 pins on my arduino to act as slave selects. So i though maybe to use relays to switch between using the pin, that way i can just use the pin for how ever many milliseconds i need then switch to the other slave select. That seemed to sort of work, except for that fact that half of the button pad i have lights up a whole row instead of 1 bar.

incase you dident read my other post here, i have the sparkfun buttons, and i couldent get 2 diffrent slave selects to work…

now my code just tells one reed relay to be off, and one to be on. Once the data sent to the first slave select of the digital pot, the relays would switch roles, and the other slave select would be controlled. But in actuality, when i tell it to turn one button on, and the other 3 off, and it just makes them dimmer, but it doesent turn the light off.

hope you understand…

either way, heres my code, and the end is my desprate attempt to make it work, so if you can see if it’s fixible, i’d owe u my life, becuase i’ve dropped about 200 bucks on all this stuff, and it would really suck if i couldent get it working…

code:

#define DATAOUT 11//MOSI
#define DATAIN 12//MISO - not used, but part of builtin SPI
#define SPICLOCK  13//sck
#define SLAVESELECT 10
byte potpin = 0;
byte r1=0;
byte g2=1;
byte g1=2;
byte b2=3;
byte b1=4;
byte r2=5;
byte res1=255;
byte res2=255;
byte res3=255;
byte res4=255;
byte res5=255;
byte res6=255;
byte delay1 = 1;
char spi_transfer(volatile char data)
{
  SPDR = data;                    // Start the transmission
  while (!(SPSR & (1<<SPIF)))     // Wait the end of the transmission
  {
  };
  return SPDR;                    // return the received byte
}

void setup()
{
  byte i;
  byte clr;
  pinMode(DATAOUT, OUTPUT);
  pinMode(DATAIN, INPUT);
  pinMode(SPICLOCK,OUTPUT);
  pinMode(SLAVESELECT,OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(14, OUTPUT);
  pinMode(15, OUTPUT);
  digitalWrite(SLAVESELECT,HIGH); //disable device
  // SPCR = 01010000
  //interrupt disabled,spi enabled,msb 1st,master,clk low when idle,
  //sample on leading edge of clk,system clock/4 (fastest)
  SPCR = (1<<SPE)|(1<<MSTR);
  clr=SPSR;
  clr=SPDR;
  delay(10);
  for (i=0;i<6;i++)
  {
    write_pot(i,255);
  }
}

byte write_pot(int address, int value)
{
  digitalWrite(SLAVESELECT,LOW);
  //2 byte opcode
  spi_transfer(address);
  spi_transfer(value);
  digitalWrite(SLAVESELECT,HIGH); //release chip, signal end transfer
}

void loop()
{
 
  digitalWrite(14, LOW);
  digitalWrite(15, HIGH);

  digitalWrite(7, LOW);
write_pot(r1, 0);

 delay(delay1);
 digitalWrite(7, HIGH);
 digitalWrite(6, LOW);
write_pot(r1, 255);
write_pot(g1, 0);
 delay(delay1);
 digitalWrite(5, LOW);
 digitalWrite(6, HIGH);
write_pot(b1, 0);
 delay(delay1);
 digitalWrite(4, LOW);
 digitalWrite(5, HIGH);
write_pot(g1, 255);
write_pot(b1, 255);
write_pot(r1, 255);
 delay(delay1);
 digitalWrite(4, HIGH);
write_pot(r1, 255);
write_pot(g1, 255);
write_pot(b1, 255);
write_pot(r2, 255);
write_pot(r2, 255);
write_pot(r2, 255);

digitalWrite(14, HIGH);
digitalWrite(15, LOW);

                         // second relay starts here
                         
                 
 digitalWrite(7, LOW);
write_pot(r1, 255);
write_pot(g1, 255);
write_pot(b1, 255);
write_pot(r2, 255);
write_pot(r2, 255);
write_pot(r2, 255);
write_pot(b1, 0);

  delay(delay1);
 digitalWrite(7, HIGH);
 digitalWrite(6, LOW);
 write_pot(b1, 255);
 delay(delay1);
 digitalWrite(5, LOW);
 digitalWrite(6, HIGH);

 delay(delay1);
 digitalWrite(4, LOW);
 digitalWrite(5, HIGH);
write_pot(r1, 255);
write_pot(g1, 255);
write_pot(b1, 255);
write_pot(r2, 255);
write_pot(r2, 255);
write_pot(r2, 255);
 delay(delay1);
 digitalWrite(4, HIGH);
write_pot(r1, 255);
write_pot(g1, 255);
write_pot(b1, 255);
write_pot(r2, 255);
write_pot(r2, 255);
write_pot(r2, 255);
 }