UTD Senior Project Team 12 / Mbed 2 deprecated Nucleo_read_thermistor

Dependencies:   mbed

main.cpp

Committer:
jchari
Date:
2015-11-17
Revision:
5:67e154e155e8
Parent:
4:b4270fbde211
Child:
6:2d1063039aab

File content as of revision 5:67e154e155e8:

#include "mbed.h"
 
AnalogIn analog_value(A0);
 
DigitalOut led(LED1);
Serial pc(USBTX, USBRX); // tx, rx

 
int main() {
    float meas;
    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
        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");
        }
        if (meas < 450) { // If the value is greater than 2V then switch the LED on
          pc.printf("Thermistor is at room temperature\r\n");
        }
        /*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
    }
}

//Jonathan changes ;asdkfj;kasdjfafklsdjfkljsdkljaf