Compare pulse count to value - Multiple Inputs

you've been told that function calls need the "()" following their names, in 2 places

when you configure an input pins in setup(), should you read the input to initialize the state of the pin (possibly avoiding a mis-count?

presumably the BCD inputs are allowed to change while the system is running, otherwise you could just read them once when in setup?

why have bcdtot75() instead of just

    if (bulbcounter >= bcdtot() * 0.75)

optical switches typically don't need debouncing. is this true?

since this will loop pretty quickly, seems that the prints will report the same number often. could track the lastCount and only print the count when it changes

consider how chkButtons() monitors multiple inputs. there's no need to maintain the current state since the previous (last) state is set to the same value.

// check multiple buttons and toggle LEDs

enum { Off = HIGH, On = LOW };

byte pinsLed [] = { 10, 11, 12 };
byte pinsBut [] = { A1, A2, A3 };
#define N_BUT   sizeof(pinsBut)

byte butState [N_BUT];

// -----------------------------------------------------------------------------
int
chkButtons ()
{
    for (unsigned n = 0; n < sizeof(pinsBut); n++)  {
        byte but = digitalRead (pinsBut [n]);

        if (butState [n] != but)  {
            butState [n] = but;

            delay (10);     // debounce

            if (On == but)
                return n;
        }
    }
    return -1;
}

// -----------------------------------------------------------------------------
void
loop ()
{
    switch (chkButtons ())  {
    case 2:
        digitalWrite (pinsLed [2], ! digitalRead (pinsLed [2]));
        break;

    case 1:
        digitalWrite (pinsLed [1], ! digitalRead (pinsLed [1]));
        break;

    case 0:
        digitalWrite (pinsLed [0], ! digitalRead (pinsLed [0]));
        break;
    }
}

// -----------------------------------------------------------------------------
void
setup ()
{
    Serial.begin (9600);

    for (unsigned n = 0; n < sizeof(pinsBut); n++)  {
        pinMode (pinsBut [n], INPUT_PULLUP);
        butState [n] = digitalRead (pinsBut [n]);
    }

    for (unsigned n = 0; n < sizeof(pinsLed); n++)  {
        digitalWrite (pinsLed [n], Off);
        pinMode      (pinsLed [n], OUTPUT);
    }
}

keeping the code simple and clean, is good practice and helps to avoid bugs