kirthiga annamalai
/
LM
gaya
Fork of temp by
main.cpp
- Committer:
- kirthigaannamalai
- Date:
- 2015-01-14
- Revision:
- 1:460ecfe930b7
- Parent:
- 0:e035f4506cd7
File content as of revision 1:460ecfe930b7:
#include "mbed.h" //Print temperature from LM61 analog temperature sensor //set p15 to analog input to read LM61 sensor's voltage output AnalogIn LM61(p15); //also setting unused analog input pins to digital outputs reduces A/D noise a bit //see http://mbed.org/users/chris/notebook/Getting-best-ADC-performance/ DigitalOut P16(p16); DigitalOut myled(LED1); DigitalOut myled2(LED2); int main() { float tempC, tempF; while(1) { //conversion to degrees C - from sensor output voltage per LM61 data sheet tempC = ((LM61*3.3)-0.600)*100.0; //convert to degrees F tempF = (9.0*tempC)/5.0 + 32.0; //print current temp printf("%5.2F C %5.2F F \n\r", tempC, tempF); wait(.5); if(P16>29) { myled=1; myled2=0; wait(1.0); } else { myled=0; myled2=1; wait(1.0); } } }