Multiplexing 4511 and two, seven segment displays

Hi everyone.

Can someone please tell me where I'm going wrong here. I'm trying to multiplex 2, 7 segment displays which will eventually become 6 once I've figured out how to multiplex them.

To make it simple for a start, I'm trying to simply write the number 32 between to 7 segment led's.

With the code below, all i am getting on the display is the number 11.

I'm assuming it's something to do with the digital.Write line in the loop.

Any help appreciated.

Thanks

int trans10 = 3;      // 10s transistor pin
int trans1 = 2;       // 1s transistor pin
int digit1 = 0;
int digit2 = 0;
int number = 0;


int digits[10][4] = {
  { 0,0,0,0     },      // 0
  { 0,0,0,1     },      // 1
  { 0,0,1,0     },      // 2
  { 0,0,1,1     },      // 3
  { 0,1,0,0     },       // 4
  { 0,1,0,1     },      // 5
  { 0,1,1,0     },      // 6
  { 0,1,1,1     },      // 7
  { 1,0,0,0     },      // 8
  { 1,0,0,1     }};     // 9

byte decToBcd(byte val)
{
  return ( (val/10*16) + (val%10) );
}

void setup()
{
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(trans10, OUTPUT);
  pinMode(trans1, OUTPUT);


}

void loop()
{
  number = 32;
  digit1 = number/10;
  digit2 = number % 10;

  {

    digitalWrite(trans10, HIGH);
    digitalWrite((int)digits, (digit1));
    digitalWrite(trans10, LOW);
  }
  {
    digitalWrite(trans1, HIGH);
    digitalWrite((int)digits, (digit2));
    digitalWrite(trans1, LOW);
  }
}

Edit: Sorry, posted the wrong code. Above is now what i have

  {

    digitalWrite(trans10, HIGH);
    digitalWrite((int)digits, (digit1));
    digitalWrite(trans10, LOW);
  }

What are the curly braces for?

digits is a 2d array of ints. Casting the address of the first element of the array to an int will not give you any kind of valid pin number.

Why is digit1 in parentheses?

  number = 32;
  digit1 = number/10;

So, digit1 is 3. What do think setting some invalid pin number to 3 is going to accomplish?

There needs to be 4 calls to digitalWrite to setup the BCD pins - but your code doesn't seem to define any pins for the BCD outputs that go to the 4511