Arduino Nano strange behavior

dnenov7:
Sorry for the comments I will change them. But you can clearly see what I want to do with the code ..

Post the latest version of your program which takes account of the comments already made.

...R