Skip to content

Instantly share code, notes, and snippets.

@gantrim
Created March 26, 2019 22:07
Show Gist options
  • Save gantrim/bb58d046dcfb7c9732073f0478839350 to your computer and use it in GitHub Desktop.
Save gantrim/bb58d046dcfb7c9732073f0478839350 to your computer and use it in GitHub Desktop.
Server Room Temp Monitor - Particle Events
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