Outputting Wiegand data to a wiegand decoding device

Hi Guys and Girls

I have had a good hunt about, and I see plenty of articles on how to READ wiegand data from a reader, but my project idea is to output wiegand data into a device that reads the string and decodes it.

The project is basicaly to test the ability of my less experienced staff how to decode a preset (or a number of preset) string(s) on our systems so that they get it right.

My ultimate goal is to have an Arduino board set up with a number of buttons so when pressed a wiegand string will be sent out to the device and they need to then come up with a decoding matrix that interprets the data correctly.

I would like to have a variety of wiegand formats available. 26, 34, 40 and if I can 96.

It's a tall order, but it would be great to have for training purposes.

Unfortunately I can't go into details exactly what this is for, but the result would be made fully available. Rest assured, this is not for anything even remotely shady.

Wiegand is easy. For each bit, if the bit is 0, pulse the '0' pin low, else pulse the '1' pin low.

I would store the string as a byte array starting with the Most Significant Bit of the Most Significant Byte. Something like this:

void OutputWiegand(byte string[], byte length)
{
  for (byte i = 0; i < length; i++)
  {
    byte byteIndex = i / 8;  // Bytes from start of string
    byte bitIndex = i % 8;  // Bits from high order bit
    boolean bit = (string[byteIndex] << bitIndex) & 0x80;
    digitalWrite(bit ? OnePin : ZeroPin, LOW);
    delayMicroseconds(50);
    digitalWrite(bit ? OnePin : ZeroPin, HIGH);
    delay(2);
  }
}