Arduino心率检测模块,手指或者脉搏放上去检测

Arduino心率检测模块,手指或者脉搏放上去检测

在这里插入图片描述

//A0口
int sensor = 0;
double alpha = 0.75;
int period = 20;
double change = 0.0;


void setup() {
    
    
  Serial.begin(115200);
  pinMode(led,OUTPUT);
  
}

void loop() {
    
    
  double oldValue = 0;
  double oldChange = 0;
  int rawValue = analogRead(sensor);
  double value = alpha*oldValue+(1-alpha)*rawValue;
  Serial.println(value);
  delay(50);
  oldValue = value;
  delay(20);
  
  
}

猜你喜欢

转载自blog.csdn.net/m0_63715549/article/details/132837992
今日推荐