
Using lm60 which is temperature sensor
Revision 0:b034db7b6b7f, committed 2014-06-05
- Comitter:
- AkiraK
- Date:
- Thu Jun 05 14:14:22 2014 +0000
- Commit message:
- Temperature_mbed;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r b034db7b6b7f main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jun 05 14:14:22 2014 +0000 @@ -0,0 +1,14 @@ +#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 + } +}
diff -r 000000000000 -r b034db7b6b7f mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Jun 05 14:14:22 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/0b3ab51c8877 \ No newline at end of file