analog input issuses

for (byte bitMask = 128; bitMask > 0; bitMask >>= 1){
    digitalWrite(clockPin, LOW);
    digitalWrite(serialOnesPin, HIGH);
    digitalWrite(serialTensPin, HIGH);
    digitalWrite(serialHundsPin, HIGH);
    digitalWrite(clockPin, HIGH);
  }

That's a pretty roundabout way of doing eight iterations. In the absence of comments, any particular reason?

the code dont fit

probably because there's too much of it.