This is NOT a complete sketch. I added some code to my version of the lab and pulled it out to share here. First you will need to figure where to put these lines of code in your sketch. Then you will undoubtedly need to adjust names, pins, and other details to make it work in your setting.
Step 1: Conditional Test:
What this portion of the lab asks you to do is generally identified as conditional coding. Do A if B is true and otherwise do C. The if([condition]){ [execute]} command is one of the simplest forms of conditional testing (it exists in python as well). Here is the Arduino Reference page for the 'if' command.
// check temperature against threshold if (temperatureC > tempThreshold) {
digitalWrite(pinLED, HIGH);
Serial.println("The temperature has exceeded your threshold");
} else { digitalWrite(pinLED, LOW); }
Step 2: Adapting
Once you figure out how to define the variables you need and assign them before the setup() loop you should be all set. Since the temperature is NOT an integer you will need to define the tempThreshold as a floating point number by using
float specialVariable = 3.4;
at the appropriate point in your sketch instead of
int specialVariable = 4;
There are other kinds of variable types that we will meet as we go along but so far we only have int and float.
I don't mean to be gratuitously confusing but I want you to learn to notice that I am using a variable in the lines of code I wrote called (usefully) tempThreshold. This is my 'specialVariable'. You may choose to call it something else. Notice that when we define variables in our Arduino sketchs it is in the section of the sketch before the 'void setup()' section of the sketch
Step 3: Experimenting
One place where this link between temperature sensors and actions is quite common is in this thesis from Harvard (yup -- that one!)). Very appropriate for this area and a post retirement project for me:)