A lot of "void"

Hi,

i have an big program on my arduino UNO, but the program its a series of checks and can be taken into very small parts.
To be easier to avoid errors and my my program easier to understand i'm thinking in making the "void loop()" a small "program" that only calls other loops.

for example:

void loop() {
check_temperature_sensors();
turn_lights_on();
check_humidity_sensors();
upload_values_to_mysql();
}

and then have separate "voids" to each operation.

is this a good way or do you think i'm doing it wrong? do you see any bad aspect of making this?

thanks!

It's a very good approach, but they're "functions", not "voids".

A void is a hole, and no-one wants a program full of holes.

One possible downside is that you'll probably have to maintain the program state in global variables, which may not be ideal.

AWOL:
It's a very good approach, but they're "functions", not "voids".

A void is a hole, and no-one wants a program full of holes.

One possible downside is that you'll probably have to maintain the program state in global variables, which may not be ideal.

sorry, I din't understood, so I have this code:

void loop() {
check_temperature_sensors();
turn_lights_on();
check_humidity_sensors();
upload_values_to_mysql();
}

then, i have a "void" for each part, for example:

void loop() {
check_temperature_sensors();
turn_lights_on();
check_humidity_sensors();
upload_values_to_mysql();
} //end of loop

void check_temperature_sensors() {
//here the code that will check the temperatures and save it to 3 diferent global variables,
so i don't need to return any value because it writes to the global variables that 
are accessible to the entire program
}

then, i have a "void" for each part, for example:

No, you have a "function" for each part; I already explained that.

The way your functions must communicate their results is via global variables; there's no other way.
This is not always ideal, and can result in inflexibility.

Look at the Thread planning and implementing a program. That shows the use of a very simple loop() function calling other functions.

...R