Numeric Input Read

First of all, that line belongs in your void setup, not your void loop.

To answer your question, read the “Synchronising the output state with the app at startup” section of this post…

Pete.