From 958a4a31df8a6b14da96c66c91dea151f34631fd Mon Sep 17 00:00:00 2001 From: "Balasuriya D.A.M" <it18021080@my.sliit.lk> Date: Mon, 2 May 2022 09:14:04 +0530 Subject: [PATCH] Modified sensor for pulse and spo2 --- .../KY-039_only_SpO2___Pulse_rate.ino | 37 +++++++++++++++---- 1 file changed, 29 insertions(+), 8 deletions(-) rename IT18021080/IoT Project/SpO2___Pulse_rate/{ => KY-039_only_SpO2___Pulse_rate}/KY-039_only_SpO2___Pulse_rate.ino (92%) diff --git a/IT18021080/IoT Project/SpO2___Pulse_rate/KY-039_only_SpO2___Pulse_rate.ino b/IT18021080/IoT Project/SpO2___Pulse_rate/KY-039_only_SpO2___Pulse_rate/KY-039_only_SpO2___Pulse_rate.ino similarity index 92% rename from IT18021080/IoT Project/SpO2___Pulse_rate/KY-039_only_SpO2___Pulse_rate.ino rename to IT18021080/IoT Project/SpO2___Pulse_rate/KY-039_only_SpO2___Pulse_rate/KY-039_only_SpO2___Pulse_rate.ino index 02e22f9..e98583e 100644 --- a/IT18021080/IoT Project/SpO2___Pulse_rate/KY-039_only_SpO2___Pulse_rate.ino +++ b/IT18021080/IoT Project/SpO2___Pulse_rate/KY-039_only_SpO2___Pulse_rate/KY-039_only_SpO2___Pulse_rate.ino @@ -1,4 +1,4 @@ -#include <Wire.h> + #include <Wire.h> #include <LiquidCrystal_I2C.h> @@ -45,8 +45,17 @@ byte sym[3][8] = { B00100 } }; - +// Define Slave I2C Address +#define SLAVE_ADDR 0x09 + +// Analog pin for potentiometer +//int analogPin = 0; +// Integer to hold potentiometer value +String val1 = "SPO"; +String val2 = "BMP"; void setup() { + Wire.begin(); + Serial.begin(9600); Serial.flush(); pinMode(sensorPin,INPUT); @@ -210,9 +219,9 @@ void loop () if(finger_status==true) { finger_status = false; lcd.clear(); - lcd.setCursor(0,0); - lcd.print("No Ear?"); - Serial.print("No Ear ?"); + lcd.setCursor(0,1); + lcd.print("No_Ear?"); + Serial.print("No_Ear ?"); } } else { @@ -373,10 +382,22 @@ void loop () if (finger_status==true){ Serial.println("SpO2 = "); Serial.println(SpO2); + +Wire.beginTransmission(0x09); // transmit to device #9 + Wire.write('S'); // sends five bytes + Wire.write(SpO2); // sends one byte + Wire.endTransmission(); // stop transmitting + + Serial.println("BPM = "); Serial.println(avBPM); - + + Wire.beginTransmission(0x09); // transmit to device #9 + Wire.write('B'); // sends five bytes + Wire.write(avBPM); // sends one byte + Wire.endTransmission(); // stop transmitting + Serial.println(); @@ -384,7 +405,7 @@ void loop () } else{ - Serial.println("No Finger"); + Serial.println("No Ear"); } @@ -425,5 +446,5 @@ digitalWrite(9, LOW); } // loop while 1 -delay(10000); +delay(1000); } -- 2.24.1