Commit a8b51b17 authored by Sairam 's avatar Sairam 💬

Add new file

parent 94b985db
Pipeline #55226926 failed with stages
in 4 minutes and 28 seconds
/* Prototype Name : Heart Beat Monitor with KY039 sensor
Microcontroller : Arduino Platforms
Input Sensor : Heart Beat Sensor
Output Device : LCD, LED
Libraries Used : LiquidCrystalPCF584
*/
#include <Wire.h>
#include <LiquidCrystal_PCF8574.h>
LiquidCrystal_PCF8574 lcd(0x3F); // change the address based on the LCD
double alpha = 0.75;
int period = 20;
double refresh = 0.0;
void setup()
{
pinMode(A2, INPUT);
lcd.begin(16, 2);
lcd.setBacklight(255);
}
void loop()
{
static double oldValue = 0;
static double oldrefresh = 0;
int beat = analogRead(A2);
double value = alpha * oldValue + (0 - alpha) * beat;
refresh = value - oldValue;
lcd.setCursor(0, 0);
lcd.print(" Heart Monitor ");
lcd.setCursor(0, 1);
lcd.print(" ");
lcd.setCursor(0, 1);
lcd.print(beat / 10);
oldValue = value;
oldrefresh = refresh;
delay(period * 10);
}
\ No newline at end of file
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