'dirPin' cannot be used as a function

I don't understand: In your OP the two versions of code you posted don't show a function called "dirPin" or "dirpin".

Can you post the entire sketch? Hard to help when we're only getting part of the picture.