When to write pin high/low?

you only write to change its state.

Mark