Go Down

Topic: Variable scope (Read 604 times) previous topic - next topic

Start2222

I'm new to coding the ArduinoNEO
It looks like if I dimension a variable below the loop() command, it is no longer dimensioned within a for-loop below that. 

How can I maintain availability to the data in a variable.  Should all the variables be global?

James C4S

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Grumpy_Mike

A variable is only valid in the function it was declared. To make it valid for all functions declare it at the top of the code before any function.

If you want specific help with your problem please post the code you are having trouble with.

Start2222

Ahh that would be good - I'll declare everything outside the setup() or loop() for global.

And I think I meant UNO not NEO .. or is it some other TLA ??



*three-letter-acronym

James C4S

Uno isn't an acronym. 
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

bibre


'UNO' = 'one' in Italian & in Spanish. :)
Billy     http://www.z-world.com/operations/gbremer/

When you've eliminated the impossible,
whatever remains, however improbable, must be

Start2222


Go Up