SeeedStudio Grove 101020033 Скачать руководство пользователя страница 10

 

 

//will change the state of LED 

unsigned

 

char

 counter

;

 

unsigned

 

long

 temp

[

21

];

 

unsigned

 

long

 sub

;

 

bool data_effect

=

true

;

 

unsigned

 

int

 heart_rate

;

//the measurement result of heart rate 

 

const

 

int

 max_heartpluse_duty 

=

 

2000

;

//you can change it follow your 

system's request. 

//2000 meams 2 seconds. System return error  

//if the duty overtrip 2 second. 

void

 setup

()

 

{

 

    pinMode

(

LED

,

 OUTPUT

);

 

    Serial

.

begin

(

9600

);

 

    Serial

.

println

(

"Please ready your chest belt."

);

 

    delay

(

5000

);

 

    arrayInit

();

 

    Serial

.

println

(

"Heart rate test begin."

);

 

    attachInterrupt

(

0

,

 interrupt

,

 RISING

);

//set interrupt 0,digital port 

}

 

void

 loop

()

 

{

 

    digitalWrite

(

LED

,

 led_state

);

//Update the state of the indicator 

}

 

/*Function: calculate the heart rate*/

 

void

 sum

()

 

{

 

    

if

(

data_effect

)

 

    

{

 

        heart_rate

=

1200000

/(

temp

[

20

]-

temp

[

0

]);

//60*20*1000/20_total_time  

        Serial

.

print

(

"Heart_rate_is:\t"

);

 

        Serial

.

println

(

heart_rate

);

 

    

}

 

    data_effect

=

1

;

//sign bit 

}

 

/*Function: Interrupt service routine.Get the sigal from the external 

interrupt*/

 

void

 interrupt

()

 

{

 

    temp

[

counter

]=

millis

();

 

    Serial

.

println

(

counter

,

DEC

);

 

    Serial

.

println

(

temp

[

counter

]);

 

Содержание Grove 101020033

Страница 1: ...Ear clip Heart Rate Sensor Version 1 0 Release date 9 20 2015 Wiki http www seeedstudio com wiki Grove_ _Heart_rate_ear_clip_kit Bazaar http www seeedstudio com depot Grove Earclip Heart Rate Sensor p 1116 html ...

Страница 2: ...2 Document Revision History Revision Date Author Description 1 0 Sep 21 2015 Victor He Create file ...

Страница 3: ...3 Contents Document Revision History 2 1 Introduction 2 2 Features 3 3 Specifications 4 4 Application Ideas 5 5 Usage 6 6 Resources 10 7 Support 11 ...

Страница 4: ...ision of Seeed Technology Inc this manual has been compiled and published which covered the latest product description and specification The content of this manual is subject to change without notice Copyright The design of this product including software and its accessories is under tutelage of laws Any action to violate relevant right of our product will be penalized through law Please conscious...

Страница 5: ...d a receiver module The heart rate measure kit can be used to monitor heart rate of patient and athlete The result can be displayed on a screen via the serial port and can be saved for analysis The entire system is a high sensitivity low power consumption and portable ...

Страница 6: ...3 2 Features Low power consumption Convenient to use High sensitivity Fully RoHS compliant ...

Страница 7: ...4 3 Specifications Item Min Typical Max Unit Voltage 3 0 5 0 5 25 V Work Current 6 5 mA Length of ear clip wire 120 cm Measures Range 30 min ...

Страница 8: ...5 4 Application Ideas Heart rate monitor ...

Страница 9: ...and paste code below to a new Arduino sketch Function This program can be used to measure heart rate the lowest pulse in the program be set to 30 Use an external interrupt to measure it Hardware Grove Ear clip Heart Rate Sensor Grove Base Shield Grove LED Arduino IDE Arduino 1 0 Author FrankieChu Date Jan 22 2013 Version v1 0 by www seeedstudio com define LED 4 indicator Grove LED is connected wit...

Страница 10: ...tln Please ready your chest belt delay 5000 arrayInit Serial println Heart rate test begin attachInterrupt 0 interrupt RISING set interrupt 0 digital port 2 void loop digitalWrite LED led_state Update the state of the indicator Function calculate the heart rate void sum if data_effect heart_rate 1200000 temp 20 temp 0 60 20 1000 20_total_time Serial print Heart_rate_is t Serial println heart_rate ...

Страница 11: ...luse duty data_effect 0 sign bit counter 0 Serial println Heart rate measure error test will restart arrayInit if counter 20 data_effect counter 0 sum else if counter 20 data_effect counter else counter 0 data_effect 1 Function Initialization for the array temp void arrayInit for unsigned char i 0 i 20 i temp i 0 temp 20 millis Upload the code please click here if you do not know how to upload ...

Страница 12: ...s the signal when we are measuring the heart rate In the left of the figures which is a waveform diagram of the detected heartbeat A high pulse comes when beating Note If the serial monitor return an error message please change the position of the sensor ...

Страница 13: ...10 6 Resources Grove Ear clip Heart Rate Sensor Demo code ...

Страница 14: ...11 7 Support If you have questions or other better design ideas you can go to our forum or wish to discuss ...

Отзывы: