global verses local variables for embeded systems
my arduino project has a setup and loop functions. the idea as i understand it is the setup tells the arduino what you want initialized and the loop is continuously run. if i declare a variable i = 0; in the loop function then increment it in side an if it looses its value on the next iteration of the loop function.
the only way round this i can see is to use a global variable and set it outside is the functions. this is alien to me as using global variables was stamped out of me.
is this just the way it is or am i doing something wrong.