The circuit used in the previous post is used for this project tooo,
Arduino source code:
//////////////////////////////////////
///created by M.Senthamizhan/////
////senthamizhanjackie@gmail.com//////
////date : 27/4/18/////////
float mix = 0.00;
#include<LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //for lcd interface initialize
int val, beat;
int count = 0;
unsigned int previoustime;
unsigned int currentime;
float del;
void setup()
{
Serial.begin(9600);
//lcd.begin(8, 2);
pinMode(A0, INPUT);
pinMode(13, OUTPUT);
//Beat status LED
}
void loop()
{
for LCD interface
lcd.setCursor(0, 0);
lcd.print(" HEART :");
lcd.setCursor(0,);
lcd.print("IS : ");
mix = 0.0;
val = analogRead(A0);
//Serial.println(val);
//mix = val+mix;
//Serial.println(mix);
if (val > 200)
{
count++;
currentime = millis();
//Serial.println(currentime);
del = currentime - previoustime;
//Serial.println(del);
previoustime = currentime;
float Q = 1000 / del;
float fb = 60 * Q;
Serial.println(fb);
//f = fb / 1000;
//Serial.println(f);
digitalWrite(13, HIGH);
delay(400);
lcd.setCursor(1,1);
lcd.print(fb);
lcd.print(" ");
lcd.print(" BPM ");
}
else
{
digitalWrite(13, LOW);
}
}
Finished design:
👏👏👏
ReplyDelete