مخطط الرسم البياني :
تحميل الكود من هنا :
// Project : Simple Heart Beat Monitor With LCD1602A
// By : DIY Channel / ABDELLATIF MIMOUNE
// My Youtube Channel : https://www.youtube.com/c/DIYChannel2019
#include <Wire.h>
#include <LiquidCrystal.h>
//------------abdellatif mimoune------------------------
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
double alpha=0.75;
int period=20;
double refresh=0.0;
//-----------diy channel-------------------------------
void setup(void)
{
pinMode(A0,INPUT);
lcd.begin(16,2);
lcd.clear();
lcd.setCursor(0,0);
}
void loop(void)
{
static double oldValue=0;
static double oldrefresh=0;
int beat=analogRead(A0);
double value=alpha*oldValue+(0-alpha)*beat;
refresh=value-oldValue;
//-----------------youtube : diy channel--------------
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 comments:
Post a Comment