How can I make this Arduino script work?

Yes, it’s that simple. However, if the function isn’t void then you would have to declare it correctly. For example:

int getPinState(byte pin) {
    ....
    return some_pin_state_value;
}

would have to be declared as:

int getPinState(byte pin);

Or:

int getPinState(byte);

Hopefully, you already know this and I’m not “teaching grandma to suck eggs”! :wink:

Cheers,
Norm.

2 Likes