Lenning Davis
/
ES202_Temp_Lab
Testing
Diff: main.cpp
- Revision:
- 0:2b98a8dd0a13
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Apr 10 23:48:39 2019 +0000 @@ -0,0 +1,45 @@ +//ES202_Temp_Lab.m +//This program will read temperature from a sensor and read the output over time +//MIDN Finnegan and MIDN Lenning Davis +//1-10-2019 + +#include "mbed.h" + +Serial pc(USBTX,USBRX); +AnalogIn sensor(p17); +PwmOut led(LED1); + +float far = 0.0; +int samples = 0; +float rate = 0.0; +int counter = 0; +float kel = 0.0; +float cel = 0.0; + + +int main(void) +{ + while(1) + { + pc.scanf("%d, %f",&samples,&rate); + while(counter < samples) + { + far = sensor * 100 *3.3; + cel = (far - 32)*.5556; + kel = cel + 273.15; + counter = counter + 1; + pc.printf("%d, %f \n", counter, far); + wait(rate); + } + counter = 0; + } +} + + + + + + + + +