Here is the program of a simple alarm device, which turns the LED on when the temperature gets higher than the desired value.
As you can note, we use the greater
node, one of the comparison nodes from the XOD standard library.
Change the logic to make the alarm working whenever the temperature gets lower than the threshold. Let the user to set this value using a potentiometer.
Replace the greater
node with less
.
Place the map
node and bind values to map 0.0…1.0 range to 15…30 degrees Celsius.
Place pot
and bind the corresponding PORT
.
Link pot
, map
, and less
nodes.
Upload the program.
Rotate the potentiometer knob to set the threshold. Heat and cool down the thermometer to see how it works.
Use both greater
and less
nodes to alarm only when the temperature is out of the range. Hint: you need the or
node.