Our Class Is Working On An Arduino Reflow Oven, Will This Code Work?

Hello, Right now I am part of an electronics class for my senior year of High School. For the advanced class, our teacher has given us free reign and wanted us to find a project of our own to do for the second semester. We got motivated after talking about reflow ovens to solder surface mount components and decided on making our own reflow oven that will controlled by an Arduino.
I just finished putting this code together and it compiled without error, I was curious if anyone could take a look at it and check whether or not it will work as intended. Here is the code we have worked on (http://codeviewer.org/view/code:3e94) Thanks for any input :slight_smile:

Got a schematic of the hardware it is to control?

CrossRoads:
Got a schematic of the hardware it is to control?

Just made a very basic attempt at a schematic with Fritzing. (Imgur: The magic of the Internet) There's a picture in there as well of our setup until we start gutting the machine and adding in the Arduino. We are using an Adafruit Thermocouple Amplifier MAX31855 to get the temperature values and using their Library in our code.

I like the general way your code is organized.

Rather than build timing into (e.g.) the preheat() function I would have another state variable that identifies whether it is at the preheat stage (H), peak stage (P) or the cool stage (C). Then each function would continue until the state changed.

Also, I would be inclined just to read the temperature once in loop() and use that value in all the functions.

This would give preheat code a bit like this pseudo code

void preheat() {
  if (heatingStage  != 'H') {
      return;
  }
  // turn heater on
  if (currentTemp >= preheatTemp) { // currentTemp was read in loop()
     heatingStage = 'P'; // move on to peak stage
  }
}

...R