From 5a44a3ca33b1f4abcb959314e2256a7244b63c82 Mon Sep 17 00:00:00 2001
From: "Balasuriya D.A.M" <it18021080@my.sliit.lk>
Date: Sat, 30 Apr 2022 10:48:53 +0530
Subject: [PATCH] MLX 90614 with Buzzer and Lighting System

---
 .../MLX90614_Infrared_Temperature_Sensor.ino       | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/IT18021080/IoT Project/MLX90614_Infrared_Temperature_Sensor/MLX90614_Infrared_Temperature_Sensor.ino b/IT18021080/IoT Project/MLX90614_Infrared_Temperature_Sensor/MLX90614_Infrared_Temperature_Sensor.ino
index 511cdf7..026bd9e 100644
--- a/IT18021080/IoT Project/MLX90614_Infrared_Temperature_Sensor/MLX90614_Infrared_Temperature_Sensor.ino	
+++ b/IT18021080/IoT Project/MLX90614_Infrared_Temperature_Sensor/MLX90614_Infrared_Temperature_Sensor.ino	
@@ -16,10 +16,18 @@ void setup() {
 }
  
 void loop() {
-  Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempC()); 
+   Serial.println();
+  Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempC());
   Serial.print("*C\tObject = "); Serial.print(mlx.readObjectTempC()); Serial.println("*C");
-  Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempF()); 
+  Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempF());
   Serial.print("*F\tObject = "); Serial.print(mlx.readObjectTempF()); Serial.println("*F");
-  Serial.println();
+    Serial.println();
+    if (mlx.readObjectTempC()>threshold){
+    digitalWrite(buzzer, HIGH);
+    digitalWrite(12, LOW);
+  } else {
+    digitalWrite(buzzer, LOW);
+    digitalWrite(12, HIGH);
+  }
   delay(10000);
 }
-- 
2.24.1