Using lm60 which is temperature sensor

Dependencies:   mbed

main.cpp

Committer:
AkiraK
Date:
2014-06-05
Revision:
0:b034db7b6b7f

File content as of revision 0:b034db7b6b7f:

#include "mbed.h"

AnalogIn value(p20); //define what port we use

float volt, temp; //make float number

int main() {
    while(1) {
        volt = value * 3.3; // This line change the point to voltage.(1 pint from mbed is 3.3 voltage. we need to change the point to voltage.)
        temp = (volt - 0.424) / 0.00625; // Refer to data sheet
        printf("temperature is %f\n", temp); //send the data to PC
        wait(1.0); //maintain the status for 1.0 second
    }
}