Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am having trouble on my mbed (c++) with getting a program to work properly. How would I take 1000 samples from a temperature sensor

I am having trouble on my mbed (c++) with getting a program to work properly.

How would I take 1000 samples from a temperature sensor and have it display the highest temperature when it finds one? I will press a button and after i press it, I need it to display a high temperature on a serial display on my computer (i know how to get it to the display, but am not sure how to get the high out of 1000 samples).

Here is what I have so far and it keeps giving the high temperature as 0:

float temp[]; float highTemp = 0; void record(void) { // displays the record high temperature for (int i = 0; i < 1000; i++) { temp[i] = ((sensor*3.3)-0.500)*100.0; if (temp[i] > highTemp) { temp[i] = highTemp; } } pc.printf("Highest Temperature = %5.2f C ", highTemp); wait(0.5);

}

sensor is the data coming from the temperature sensor, i am displaying it to Tera Term on my computer to see the high when i click the button. I cannot figure out how to click the button once and have it continue to display instead of me clicking it and only displaying while the button is pressed down. I also need to know how to set up the array correctly so it does not display 0.

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_2

Step: 3

blur-text-image_3

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

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions

Question

Identify employee service benefits.

Answered: 1 week ago