/*
We need your help to stop forest fires and bake tasty cookies!
See `requirements.md` for how to help.
Then check `notes.md`.
*/
#include "api.h"
#define TEMP_GOAL 180
#define ALLOWABLE_FLUCTUATION 5 //we want to hold temp at TEMP_GOAL +/- ALLOWABLE_FLUCTUATION
void setup() {
Serial.begin(115200);
setup_api();
Serial.println("Elf oven 2000 starting up.");
serial_printf("Days without fire incident: %i\n", 0);
}
void loop() {
uint16_t temperature = get_temperature();
serial_printf("Temperature %i\n", temperature);
uint16_t door_status = read_voltage(DOOR_SENSOR);
serial_printf("Door status %i\n", door_status);
set_output(GAS_VALVE, temperature > TEMP_GOAL && door_status != 0);
delay(1000);
}