Lenning Davis
/
ES202_Temp_Lab
Testing
main.cpp
- Committer:
- m211374
- Date:
- 2019-04-10
- Revision:
- 0:2b98a8dd0a13
File content as of revision 0:2b98a8dd0a13:
//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; } }