UTD Senior Project Team 12 / Mbed 2 deprecated Nucleo_read_thermistor

Dependencies:   mbed

Revision:
3:b8aaacdd726e
Parent:
1:0490a15c76e4
Child:
4:b4270fbde211
--- a/main.cpp	Thu Mar 12 08:22:00 2015 +0000
+++ b/main.cpp	Tue Nov 17 21:29:49 2015 +0000
@@ -3,22 +3,25 @@
 AnalogIn analog_value(A0);
  
 DigitalOut led(LED1);
+Serial pc(USBTX, USBRX); // tx, rx
 
+ 
 int main() {
     float meas;
-    
-    printf("\nAnalogIn example\n");
-    
+    pc.printf("AnalogIn example: ");
     while(1) {
         meas = analog_value.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
         meas = meas * 3300; // Change the value to be in the 0 to 3300 range
-        printf("measure = %.0f mV\n", meas);
-        if (meas > 2000) { // If the value is greater than 2V then switch the LED on
-          led = 1;
+        pc.printf("measure = %.0f mV\r\n", meas);
+        if (meas >= 450 ) { // If the value is greater than 2V then switch the LED on
+          pc.printf("Thermistor is being worn\r\n");
         }
-        else {
-          led = 0;
+        if (meas < 450) { // If the value is greater than 2V then switch the LED on
+          pc.printf("Thermistor is at room temperature\r\n");
         }
-        wait(0.2); // 200 ms
+        /*if (meas <= 500 && meas >= 450) { // If the value is greater than 2V then switch the LED on
+          pc.printf("Thermistor is in cloth\r\n");
+        }*/
+        wait(1); // 200 ms
     }
 }