as I can bind four diferentesles sketch I leave programs each and would be grate

I'm working on a project with Arduino Mega one DHT11 , DS18B20 a DS1307 clock and Ethernet Shield sensor ( which only use the SD ) . my problem is that I have tested separately with each, with different programs and I found on the net ( I clarify that I am new to the Arduino and therefore not much programming ) . then I want to read the sensors and time, and go writing or saved to SD sensores.Tengo information from separate programs but more as I find them together into one.
I leave programs each and would be grateful if someone could help me , thanks in advance .

I don't think that there are any ways to have more than one setup and main loop, however what I usually do is something like this:

void setup{
myCodeHere
}
void loop{
moreCode
}
and
void setup{
moreCode
}
void loop{
evenMoreCode
combine into:
void setup{
myCodeHere
moreCode
}
void loop{
moreCode
evenMoreCode
}
Another way of putting it is you combine the setup and loop code in one large sketch.

@Bryan5321 - if you get any responses to this thread in the Spanish section, please ensure that the replies are echoed here.

If your problem is that you do not know how to combine a few programs into one program this demo should be helpful. It is similar to what @Eosti has suggested except that it keeps the code in different functions rather than merging everything into loop().

However I suspect your task will be more complicated because the different programs may be trying to use the same resources such as I/O pins.

...R

Bryan5321:
I'm working on a project with Arduino Mega one DHT11 , DS18B20 a DS1307 clock and Ethernet Shield sensor ( which only use the SD ) . my problem is that I have tested separately with each, with different programs and I found on the net ( I clarify that I am new to the Arduino and therefore not much programming ) . then I want to read the sensors and time, and go writing or saved to SD sensores.Tengo information from separate programs but more as I find them together into one.
I leave programs each and would be grateful if someone could help me , thanks in advance .

In the best case you would put all the things from each setup() into one setup and all the parts in loop() in one loop.

There should only be one setup() and one loop().

But if anything runs with delay() in the code, you probably need to change the code to get rid of delay(). The reason is that every delay() makes everything wait. For just one task that needs to wait anyway it's no problem but it can be a problem for other tasks.

That stated, you may not need to change anything if you don't mind running just one thing at a time. In that case you just put the pieces together and mind that you get the pins right. You could read one thing and then the next, etc, if you don't need tasks working at the same time.

I will consider, and make evidence.
thank you very much