2 Improved indentation and use of capitals.
source | link

Are Global Variables Evilglobal variables evil in Arduino?

I'm relatively new at programming and many of the coding best practices I'm reading effectively state that there are very few good reasons to use a global variable (Oror that the best code has no globals at all).

I've done my best to keep this in mind, when writing software to make an Arduino interface with an SD card, talk to a computer and run a motor controller.  

I currently have 46 globals for about 1100 lines of "beginner level," code (no line having more than one action). Is this a good ratio or should I look at reducing it more? Also what practices can I employ to reduce the number of globals further?  

I'm asking this here because I'm specifically concerned with best practices for coding on Arduino products rather than computer programming in general.

Are Global Variables Evil in Arduino?

I'm relatively new at programming and many of the coding best practices I'm reading effectively state that there are very few good reasons to use a global variable (Or that the best code has no globals at all).

I've done my best to keep this in mind, when writing software to make an Arduino interface with an SD card, talk to a computer and run a motor controller.  

I currently have 46 globals for about 1100 lines of "beginner level," code (no line having more than one action) Is this a good ratio or should I look at reducing it more? Also what practices can I employ to reduce the number of globals further?  

I'm asking this here because I'm specifically concerned with best practices for coding on Arduino products rather than computer programming in general.

Are global variables evil in Arduino?

I'm relatively new at programming and many of the coding best practices I'm reading effectively state that there are very few good reasons to use a global variable (or that the best code has no globals at all).

I've done my best to keep this in mind, when writing software to make an Arduino interface with an SD card, talk to a computer and run a motor controller.

I currently have 46 globals for about 1100 lines of "beginner level," code (no line having more than one action). Is this a good ratio or should I look at reducing it more? Also what practices can I employ to reduce the number of globals further?

I'm asking this here because I'm specifically concerned with best practices for coding on Arduino products rather than computer programming in general.

    Tweeted twitter.com/StackArduino/status/884821499441332225
1
source | link

Are Global Variables Evil in Arduino?

I'm relatively new at programming and many of the coding best practices I'm reading effectively state that there are very few good reasons to use a global variable (Or that the best code has no globals at all).

I've done my best to keep this in mind, when writing software to make an Arduino interface with an SD card, talk to a computer and run a motor controller.

I currently have 46 globals for about 1100 lines of "beginner level," code (no line having more than one action) Is this a good ratio or should I look at reducing it more? Also what practices can I employ to reduce the number of globals further?

I'm asking this here because I'm specifically concerned with best practices for coding on Arduino products rather than computer programming in general.