4 channel relay with 4 buttons

To make it easy for people to help you please modify your post and use the code button </> so your code looks like this and 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