Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function that calculates heart beats per minute. The current code gets 10 pulse samples and averages them out. Change the code so it

Write a function that calculates heart beats per minute. The current code gets 10 pulse samples and averages them out. Change the code so it calculates heart beats per minute.

#include "msp430g2253.h" // Variables int adc[10] = {0}; //Sets up an array of 10 integers and zero's the values int avg_adc = 0; // Function prototypes void adc_Setup(); void adc_Sam10(); //Samples 10 values void main() { WDTCTL = WDTPW + WDTHOLD; // Stop WDT adc_Setup(); // Fucntion call for adc_setup while(1) { long adctot = 0; adc_Sam10(); // Fills adc[10] array with pulse readings // Add all the sampled data and divide by 10 to find average int i = 0; for(i = 0; i <= 9; i++){ adctot = adctot + adc[i]; } avg_adc = adctot/50; } } 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions

Question

1. Identify three approaches to culture.

Answered: 1 week ago

Question

3. Identify and describe nine cultural value orientations.

Answered: 1 week ago

Question

4. Describe how cultural values influence communication.

Answered: 1 week ago