Assigning "code" from keypad input

So I have the following code that I have been helped with and I think the only thing I’m missing for the desired output is a way to assign “code” as a variable from the input of bits. I’ve tried a few things and had no luck. Does anyone have any ideas that could help?

Thanks.

int relay1 = 4;
int relay2 = 5;
int relay3 = 6;
int relay4 = 7;
int relay5 = 8;
int relay6 = 9;
int relay7 = 10;
int relay8 = 11;
int code;


#include <Wiegand.h>
WIEGAND wg;

// Connect D0 to Pin 2 and D1 to Pin 3 on an Arduino UNO
const byte PinD0 = 2;
const byte PinD1 = 3;
const byte IntD0 = 0;
const byte IntD1 = 1;

volatile unsigned BitCount;
volatile byte Bits[100];
volatile unsigned long LastBitTime;
  
 void setup(){
  Serial.begin(9600); //open serial port
  wg.begin();


   pinMode(PinD0, INPUT);          // Set D0 pin as input
  pinMode(PinD1, INPUT);          // Set D1 pin as input
  attachInterrupt(IntD0, ReadD0, FALLING); // Hardware interrupt - high to low pulse
  attachInterrupt(IntD1, ReadD1, FALLING); // Hardware interrupt - high to low pulse
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
pinMode(relay3, OUTPUT);
pinMode(relay4, OUTPUT);
pinMode(relay5, OUTPUT);
pinMode(relay6, OUTPUT);
pinMode(relay7, OUTPUT);
pinMode(relay8, OUTPUT);

digitalWrite(relay1, LOW);
digitalWrite(relay2, LOW);
digitalWrite(relay3, LOW);
digitalWrite(relay4, LOW);
digitalWrite(relay5, LOW);
digitalWrite(relay6, LOW);
digitalWrite(relay7, LOW);
digitalWrite(relay8, LOW);

  }

void ReadD0() {
  if (BitCount < 100) {
    LastBitTime = millis();
    Bits[BitCount++] = 0;
  }
}

void ReadD1() {
  if (BitCount < 100) {
    LastBitTime = millis();
    Bits[BitCount++] = 1;
  }
}
    







void loop() {
  byte localBits[100];
  // Grab volatile variables with interupts disabled
  noInterrupts();
  unsigned long interval = millis() - LastBitTime;
  unsigned count = BitCount;
  interrupts();

  // Process data when we have new bits, but not for a while.
  if (interval > 100 && count != 0) {
    noInterrupts();
    for (unsigned i = 0; i < count; i++) {
      localBits[i] = Bits[i];
    }
    BitCount = 0;
    interrupts();

    Serial.print(count);
    Serial.print(" bits: ");
    for (unsigned i = 0; i < count; i++) {
      Serial.print(localBits[i]);
      if (i % 8 == 7)
        Serial.write(' ');
    }
    Serial.println();
  }

  
if (code == 1469){
digitalWrite(relay1, HIGH);
}
if (code == 6219){
digitalWrite(relay2, HIGH);
}
if (code == 2020){
digitalWrite(relay3, HIGH);
}
if (code == 5123){
digitalWrite(relay4, HIGH);
}
if (code == 617){
digitalWrite(relay5, HIGH);
}
if (code == 8670){
digitalWrite(relay6, HIGH);
}
if (code == 3313){
digitalWrite(relay7, HIGH);
}
if (code == 7117){
digitalWrite(relay8, HIGH);
}
if (code == 9731){
digitalWrite(relay1, LOW);
digitalWrite(relay2, LOW);
digitalWrite(relay3, LOW);
digitalWrite(relay4, LOW);
digitalWrite(relay5, LOW);
digitalWrite(relay6, LOW);
digitalWrite(relay7, LOW);
digitalWrite(relay8, LOW);
}

}

You're missing a ton of detail in your question. Read it back to yourself and see if you think someone who is not you would be able to tell what you really want this code to do. You speak of getting the desired output... But you give no clues as to what that output should be.

OK, Now I see that this is a continuation of another thread. http://forum.arduino.cc/index.php?topic=488293.0

OP. please keep it on the other thread where there is context.

Delta_G: OK, Now I see that this is a continuation of another thread. http://forum.arduino.cc/index.php?topic=488293.0

OP. please keep it on the other thread where there is context.

It is, but the thread was about reading data from wiegand, which was answered. I figured a new thread on a much more basic subject (assigning variables) would be easier for others to answer and would appeal to others who wouldn't initially check on a thread about a much more specific subject matter.

I thought this would be fine since it was a separate question entirely. If not, my bad.

As far as on the vagueness of the topic, the output isn't really part of the problem so I didn't want to give unnecessary information. If you need any further clarification on the subject, "code" is assigned as an integer at the beginning of the code, but doesn't actually have any data stored it in from the code. And as the title said, I'd like to take input from the keypad and use it as "code" in order to satisfy the If statements.

Again, sorry for any trouble.