Browse Source

Update todoFindCoolNameForProject/todoFindCoolNameForProject.ino

master
Anastasia Pachni Tsitiridou 6 years ago
parent
commit
7ddb8c480f
  1. 38
      todoFindCoolNameForProject/todoFindCoolNameForProject.ino

38
todoFindCoolNameForProject/todoFindCoolNameForProject.ino

@ -62,22 +62,34 @@ void getNewSamples() {
float lastTemperature = getNewTemp();
if (lastTemperature >= HIGH_TEMP) {
// Turns red led and relay on
// Turns red led on
digitalWrite(HIGH_TEMP_LED_PIN, HIGH);
digitalWrite(RELAY_PIN, HIGH);
// Turns blue led off
digitalWrite(LOW_TEMP_LED_PIN, LOW);
} else if (lastTemperature < LOW_TEMP) {
// Turns blue led on
digitalWrite(LOW_TEMP_LED_PIN, HIGH);
Serial.print(F("Warning: temperature above "));
Serial.print(HIGH_TEMP);
Serial.println(F("°C "));
//todo send email
} else if (lastTemperature < HIGH_TEMP) {
// Turns red led off
digitalWrite(HIGH_TEMP_LED_PIN, LOW);
digitalWrite(RELAY_PIN, LOW);
} else {
// Turns red led off
digitalWrite(LOW_TEMP_LED_PIN, LOW);
} else if (lastTemperature < LOW_TEMP){
// Turns blue led on
digitalWrite(LOW_TEMP_LED_PIN, HIGH);
Serial.print(F("Warning: temperature below "));
Serial.print(LOW_TEMP);
Serial.println(F("°C "));
//todo send email
} else if (lastTemperature >= LOW_TEMP) {
// Turns blue led off
digitalWrite(HIGH_TEMP_LED_PIN, LOW);
digitalWrite(LOW_TEMP_LED_PIN, LOW);
} else if (lastTemperature >= HIGH_TEMP_RELAY){
// Turns relay on
// this could start a fan
digitalWrite(RELAY_PIN, HIGH);
Serial.print(F("Warning: extremely high temperature. "));
Serial.println(F("Fan activated."));
} else if (lastTemperature < HIGH_TEMP_RELAY){
// Turns relay off
// this could cause the fan to stop working
digitalWrite(RELAY_PIN, LOW);
}
@ -128,6 +140,8 @@ float calcAverageTempAndReset() {
// Resets the readings counter
temperatureReadingsCounter = 0;
// TODO send email -> emailAverageTemp(averageTemp)
return sum/BUFFER_SIZE;
}

Loading…
Cancel
Save