Friends, I am working on a prjecet bu there is a problem. The problem seems ugly to me
1- I have seen that when ''void loop()'' function is executed fully firstly and starts second exexution every declared variable data at the end of the first execution is lost when it starts next execution of loop. Is this the case or am I wrong?
My case: I am using a variable lets say a=k*5. k is read value from sensors. Lets say at the end of the first execution of ''void loop()'' the variable is 231. if I write printout function at each loop before the '' a=k*5'' it always prints 0. Note I have defined the variable in ''void loop()'' function. How can I define this variable in a way that I can use it for next loop.
2- What is the difference between defining a variable or constant in the ''void loop()'' and out of the loop?
Thanks in advance