Yes, it goes on and off rapidly
Robin2:
To make it easy for people to help you please modify your post and use the code button </>so your code looks like thisand is easy to copy to a text editor. See How to use the Forum.
ALSO, please use the AutoFormat tool to indent your program code consistently for easier reading.
You say that the output starts flickering - does that mean that a relay goes on and off rapidly?
...R