By the way "main" is potentially a confusing choice for a variable name in a C/C++ program because all such programs have a function called main(). The Arduino IDE hides this from you, but it is there in the background and people who are familiar with C will be aware of that and may be confused.
...R