GytisPa:
But code is good?
The code is not good. Here are the errors I found with a quick look. There may be others:
-
You define variable ‘pasetasPlotas’ in two different places as two different variable types.
-
You’re accessing shared volatile variables in the ‘loop()’ function without first protecting them by disabling interrupts. Since these accesses are probably not atomic, you can get unreliable and unfathomable results.
-
You’re printing to the LCD on EVERY pass through ‘loop()’. That will happen hundreds (or thousands) of times per second. That’s way too often. Either add a ‘delay()’ -- a poor technique choice. Or, learn to use ‘millis()’ timers -- much better technique.
-
The ‘static’ designation of your global variables is unnecessary. Not really an error, it doesn’t hurt, but it’s unnecessary.