Read First

  • Variables, Scope, You have to understand scope before reading about passing variables in Functions.

A variable declared inside the Function loop can only be accessed from inside loop. If you declare a variable inside setup, it can only be used there as well. Variables that are declared before the Setup function are global and can be used anywhere. Here is another page on this if needed. http://arduino.cc/en/Reference/scope