Firmware flow
Compare the temperature and update local feedback
Selected firmware fragment: alarm output and conditional LCD refresh.
The output follows the current temperature-versus-limit comparison. The sketch then reports the output and refreshes the LCD only when its update flag is set.
Failed reads leave the stored temperature unchanged. The source does not establish sensor accuracy or hardware alarm testing.
Read the implementation
Selected firmware excerpt. The diagram explains the code; it is not a hardware test.
Selected source excerpt
// --- Set Trigger Output Pin Based on Alarm Condition ---
if (currentTemp >= triggerLimit) {
digitalWrite(triggerPin, HIGH);
} else {
digitalWrite(triggerPin, LOW);
}
// Debug: Print the state of triggerPin to Serial Monitor
Serial.print("Trigger Pin state: ");
Serial.println(digitalRead(triggerPin));
// --- Update LCD Display Only When Needed ---
if (updateLCDFlag) {
updateLCD();
updateLCDFlag = false;
}
}Technical notes
Temperature and threshold
The sketch reads temperature every two seconds. Two debounced buttons raise or lower the alarm limit by one degree, and the output is high when the stored temperature reaches or exceeds that limit.
Display updates
The I2C LCD shows the temperature, limit and alarm indicator. A flag requests refreshes after valid readings or limit changes; Serial reports diagnostic information.
Reading failures
Failed reads leave the stored temperature unchanged. The sketch reports the failure over Serial but has no separate sensor-failure alarm; measurement accuracy and hardware alarm operation were not tested.