Created
March 26, 2019 22:07
-
-
Save gantrim/bb58d046dcfb7c9732073f0478839350 to your computer and use it in GitHub Desktop.
Server Room Temp Monitor - Particle Events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int result = DHT.acquireAndWait(2000); | |
serverTemp = DHT.getFahrenheit(); | |
serverHumidity = DHT.getHumidity(); | |
if(serverTemp>=serverTempMax && !overheatDetected){ | |
Particle.publish("server_temp", "overheat"); | |
overheatDetected = true; | |
} | |
else if(serverTemp<serverTempMax && overheatDetected){ | |
Particle.publish("server_temp", "normal"); | |
overheatDetected = false; | |
} | |
if(serverHumidity>=serverHumidityMax && !tooHumid){ | |
Particle.publish("server_humidity", "tooHumid"); | |
tooHumid = true; | |
} | |
else if(serverHumidity<serverHumidityMax && tooHumid){ | |
Particle.publish("server_humidity", "normal"); | |
tooHumid = false; | |
} | |
delay(10000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment