hello!
what @Jamin says, he is absolutely right:
by default all arduino pins are set to input. there is no reason to declare input_pullup then output. or maybe you should elaborate why you did this?
other things:
-
probably it would be better to use
<DHT.h>
instead of"DHT.h"
at line 5., and the same applies to “RTClib.h”, line 7. -
it is a good idea to always define the #defines in UPPERCASE, this way you always know that it is not a variable.
-
the biggest problem i see is this part (besides setting input then output):
//pinMode(nutePumps[8], INPUT_PULLUP);
//pinMode(Valves[13], INPUT_PULLUP);
pinMode(Relays[8], INPUT_PULLUP); //
pinMode(Relays[8], OUTPUT);
pinMode(nutePumps[8], OUTPUT);
pinMode(Valves[13], OUTPUT);
i assume, that you think these lines will set all elements in the array as outputs.
but this is a nasty bug!
actually, when you write nutePumps[8] or Valves[13], you are not referring to the whole array, just to the 8th or 13th element of the nutePumps and Valves array. which are inexistent, because array indexing begins from 0, not from 1! so the last index of the nutePumps array will be 7, not 8. and the same applies to Valves array.
form my experience, assigning value to an nonexistent index of an array will silently write that value to a different part of the flash, causing severe anomalies and hard to find bugs. http://stackoverflow.com/questions/29431559/difference-between-accessing-non-existent-array-index-and-existing-but-empty-ind
you should definitely read and understand how arrays work: https://www.arduino.cc/en/Reference/Array
- you just can not set multiple pinModes using this method:
pinMode(Valves[13], OUTPUT);
even if the respective index is valid, it will set ONLY the 13th pin value to output, not the whole array.
to set the state of multiple pins, you should use a for cycle, something like this:
for (byte light = LIGHTmin; light < LIGHTmax + 1; light++) { // setup lights as outputs
pinMode(light, OUTPUT);
digitalWrite(light, LOW); // or HIGH, as you prefer
}
or like this:
for (byte i = 0; i < maxValue + 1; i++) pinMode(myArray[i], INPUT_PULLUP);
EDIT: i just saw that you find the problem, while i was writing this post. but now i will leave it anyway, hope it will be useful for someone.