/**
* Displays the anode column with the given number value; [0, 24].
*/
void displayNum(int num){
//constrain the argument to be between 0 and 24 inclusive.
num = constrain(num, 0, 24);
/*
* AND: selects the bit, the bit at weight will be 1 if the pin is to be high
* >>: shifts the selected bit to the end of the word, making the value a 0 or 1
* first result is lsb
* digitalWrite: write the approptiate result (HIGH or LOW)
* to the appropriate decoder pin
*/
for(int weight=1, pin=0; pin < DECODER_BITS; weight*=2, pin++)
digitalWrite(decoderPins[pin] ,(num & weight) >> pin);
//delay, this is the absoloute minimum time the light will be displayed.
//ensures adequate delay for decoders as well.
delayMicroseconds(MICRO);
}