Greenhouse Project

Hello,

I'm beginner in programming arduino and need help to add the codes all in one.
The sprinkler system is activated by the dht11 and moisture;
I also have a fan to cool the air inside the greenhouse, is activated by dht11.

C_Bomba.ino (153 Bytes)

dht.ino (669 Bytes)

MOISTUREE.ino (623 Bytes)

Servo_PIR.ino (2.19 KB)

water_sensor.ino (464 Bytes)

You can do this by intelligent blunder. Assuming the programmes you list work, you just need to merge the preambles of each into the preamble for one, and then do the same for the Setups, avoiding duplications in both. Nothing is critical in the order. The new loop may simply be for timing and output, using the loops you have as subroutines more or less as found.

There are plenty of examples around of this.

Indeed just copy/paste your code into a single sketch, it's quite easy. Do put everything in subroutines, makes maintenance later a lot easier.

Your hardest part will be the control of the system: how long to sprinkle for (NOT until your moisture sensor gives the OK, which may be much too short or much too long), same for the cooling part. Also not the moment your moisture sensor gives a low/high reading, as that may just be an error (they're not perfectly reliable). You also don't want to be switching on and off your fans and sprinklers 100 times a day. Build in delays and/or hysteresis.