Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Grove_Temp_Hello_world
Revision 4:7e6f5d859469, committed 2016-03-10
- Comitter:
- peipei123
- Date:
- Thu Mar 10 19:39:43 2016 +0000
- Parent:
- 3:2b40039c6e54
- Child:
- 6:2d65df11758a
- Commit message:
- 1
Changed in this revision
| Grove_temp_sensor.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Grove_temp_sensor.cpp Thu Mar 10 19:28:33 2016 +0000
+++ b/Grove_temp_sensor.cpp Thu Mar 10 19:39:43 2016 +0000
@@ -11,9 +11,9 @@
{
double a;
- a=ain.read()*1023;
- resistance=(float)(1023-a)*10000/a;
- temperature=1/(log(resistance/10000)/3975+1/298.15)-276.05;
+ a=_pin.read()*1023;
+ double resistance=(float)(1023-a)*10000/a;
+ double temperature=1/(log(resistance/10000)/3975+1/298.15)-276.05;
//conver C to F;
temperature = (9.0*temperature)/5.0 + 32.0;
return temperature;
@@ -23,8 +23,8 @@
{
double a;
- a=ain.read()*1023;
- resistance=(float)(1023-a)*10000/a;
- temperature=1/(log(resistance/10000)/3975+1/298.15)-276.05;
+ a=_pin.read()*1023;
+ double resistance=(float)(1023-a)*10000/a;
+ double temperature=1/(log(resistance/10000)/3975+1/298.15)-276.05;
return temperature;
}
Grove Temperature Sensor