Progressing well on my little first time Arduino project (weather warning device with 3G connection)
The warning I am trying to generate is based on a published table and I'm trying to do this with an IF statement where I compare a range of values and act on the result.
This is what I have come up with but its not acting quite how I would expect
Verbosely what its meant to do:
If the TEMP is between certain values, and the RH is between certain values and the wind speed (x) is above a certain value send the alert where there are a range of humidity values and wind speeds for each temp range.
So I have set the temp range first, then AND that with a humidity and temp combination, and then OR'd the various other Humidity & Wind combos to trigger the alert
There are 7 of these "blocks" or code with the various table values as required.
It seems to trigger at the required point but then send 7 alerts - not one!
Can anyone spot what might be the issue? Remember I'm new to Arduino and struggling with some of the concepts but I think I've done alright to have this thing doing what its doing so far!
if ((DHT.temperature) >=20 && (DHT.temperature) <25 && //TEMP BETWEEN 20 & 25
((DHT.humidity) >=5 && (DHT.humidity) <10 && (x) >=29)
|| ((DHT.humidity) >=10 && (DHT.humidity) <15 && (x) >=33)
|| ((DHT.humidity) >=15 && (DHT.humidity) <20 && (x) >=36)
|| ((DHT.humidity) >=20 && (DHT.humidity) <25 && (x) >=38)
|| ((DHT.humidity) >=25 && (DHT.humidity) <30 && (x) >=40)
|| ((DHT.humidity) >=30 && (DHT.humidity) <40 && (x) >=43)
|| ((DHT.humidity) >=40 && (DHT.humidity) <50 && (x) >=46)
|| ((DHT.humidity) >=50 && (DHT.humidity) <60 && (x) >=50)
|| ((DHT.humidity) >=60 && (DHT.humidity) <65 && (x) >=53)
|| ((DHT.humidity) >=65 && (x) >=55)
)
{
Serial.println("message sent");
ALERT();
}