Codigo para el sensor de temperatura

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
AndreaC
Date:
Tue Dec 02 07:01:10 2014 +0000
Commit message:
sensorTemperatura

Changed in this revision

mbed.bld Show annotated file Show diff for this revision Revisions of this file
sensorTemperatura.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Dec 02 07:01:10 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sensorTemperatura.cpp	Tue Dec 02 07:01:10 2014 +0000
@@ -0,0 +1,17 @@
+#include "mbed.h"
+#include <math.h>
+
+AnalogIn pinTemperatura(PTB1);  
+float temperatura;
+float lecturaPin;
+Serial pc(USBTX, USBRX);
+
+int main() 
+{
+    while(1) 
+    {
+        lecturaPin = pinTemperatura.read();
+        temperatura = (1/(0.002375311945203 + (0.000246322089759 * log(lecturaPin)) + (pow((0.000000280194860 * log(lecturaPin)), 3))));
+        pc.printf("Temperatura: %f\n", temperatura - 273.15);
+    }
+}
\ No newline at end of file