• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomeArduinoSensors Kit for ArduinoKY039: Heatbeat Sensor Module
Previous Next

KY039: Heatbeat Sensor Module

Posted by: admin , April 25, 2014

// Project 12 - Pulse Monitor Test Script

 

int ledPin = 13;

int sensorPin = 0;

 

double alpha = 0.75;

int period = 20;

double change = 0.0;

 

void setup()                   

{

  pinMode(ledPin, OUTPUT);

  Serial.begin(115200);

}

 

void loop()                    

{

    static double oldValue = 0;

    static double oldChange = 0;

    int rawValue = analogRead(sensorPin);

    double value = alpha * oldValue + (1 - alpha) * rawValue;

 

    Serial.print(rawValue);

    Serial.print(",");

    Serial.println(value);

 

    oldValue = value;

    delay(period);

}

Tags: Sensors Kit for Arduino

Share!
Tweet

admin

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors