Commit 958a4a31 authored by Balasuriya D.A.M.'s avatar Balasuriya D.A.M.

Modified sensor for pulse and spo2

parent 0cc4c520
#include <Wire.h> #include <Wire.h>
#include <LiquidCrystal_I2C.h> #include <LiquidCrystal_I2C.h>
...@@ -45,8 +45,17 @@ byte sym[3][8] = { ...@@ -45,8 +45,17 @@ byte sym[3][8] = {
B00100 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() { void setup() {
Wire.begin();
Serial.begin(9600); Serial.begin(9600);
Serial.flush(); Serial.flush();
pinMode(sensorPin,INPUT); pinMode(sensorPin,INPUT);
...@@ -210,9 +219,9 @@ void loop () ...@@ -210,9 +219,9 @@ void loop ()
if(finger_status==true) { if(finger_status==true) {
finger_status = false; finger_status = false;
lcd.clear(); lcd.clear();
lcd.setCursor(0,0); lcd.setCursor(0,1);
lcd.print("No Ear?"); lcd.print("No_Ear?");
Serial.print("No Ear ?"); Serial.print("No_Ear ?");
} }
} else { } else {
...@@ -373,10 +382,22 @@ void loop () ...@@ -373,10 +382,22 @@ void loop ()
if (finger_status==true){ if (finger_status==true){
Serial.println("SpO2 = "); Serial.println("SpO2 = ");
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("BPM = ");
Serial.println(avBPM); 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(); Serial.println();
...@@ -384,7 +405,7 @@ void loop () ...@@ -384,7 +405,7 @@ void loop ()
} }
else{ else{
Serial.println("No Finger"); Serial.println("No Ear");
} }
...@@ -425,5 +446,5 @@ digitalWrite(9, LOW); ...@@ -425,5 +446,5 @@ digitalWrite(9, LOW);
} // loop while 1 } // loop while 1
delay(10000); delay(1000);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment