Start in the same state after turning the power off and on

Hi, ruilviana/markd833

Sorry about Leds they must indeed be outputs.
I have tested the modified program and it works.
I have to say that I don't fully understand how it works yet.
But I'm going to apply it in my project.

Thanks for support,
Jan