Creating Function! Not working Properly

You are using pass-by-value now. The call has no variables that contain values, so pass-by-value must be used.

If you changed the function call to use the global variables, nothing would change, because the value in the variable is passed, not the address of the variable.

Pass-by-reference passes the address of the variable, so that changes made to the variables are known to the caller (for the next call).

You use type &name, instead of type name, in the function declaration/implementation to use pass-by-reference. You can't (meaningfully) then use constants in the call.

But, with global variables that you want o modify, the function really doesn't need to take any arguments. Let it operate on/with the global variables.

Of course, when you start making multiple calls, wanting to operate on different pins, etc., that will be a problem.

So, understand arrays and pass-by-reference.