I assume you found out how to use code tags by reading the forum guide in the "please read" sticky post. There was other advice there, do you remember? Like posting links to the components and modules you are using.
Looking at your code, which fortunately was readable even though you did not use code tags, the problem may not be your code. Please post a schematic, including details of the power supply you are using. The watchdog error you posted makes me wonder if your circuit is not powered adequately.
You are right, I should have used code tags. Sorry for the inconvenience.
I mentioned by rewiring to get the code workind without errors.
Thank you very much for your suggestions.
I will use code tags next time.