UTD Senior Project Team 12 / Mbed 2 deprecated Nucleo_read_thermistor

Dependencies:   mbed

Committer:
nkadhikari
Date:
Tue Nov 17 21:46:35 2015 +0000
Revision:
4:b4270fbde211
Parent:
3:b8aaacdd726e
Child:
5:67e154e155e8
added Nir comment

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 0:c2d1ad5059da 1 #include "mbed.h"
bcostm 0:c2d1ad5059da 2
bcostm 0:c2d1ad5059da 3 AnalogIn analog_value(A0);
bcostm 0:c2d1ad5059da 4
bcostm 1:0490a15c76e4 5 DigitalOut led(LED1);
jchari 3:b8aaacdd726e 6 Serial pc(USBTX, USBRX); // tx, rx
bcostm 1:0490a15c76e4 7
jchari 3:b8aaacdd726e 8
bcostm 0:c2d1ad5059da 9 int main() {
bcostm 1:0490a15c76e4 10 float meas;
jchari 3:b8aaacdd726e 11 pc.printf("AnalogIn example: ");
bcostm 1:0490a15c76e4 12 while(1) {
bcostm 1:0490a15c76e4 13 meas = analog_value.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
bcostm 1:0490a15c76e4 14 meas = meas * 3300; // Change the value to be in the 0 to 3300 range
jchari 3:b8aaacdd726e 15 pc.printf("measure = %.0f mV\r\n", meas);
jchari 3:b8aaacdd726e 16 if (meas >= 450 ) { // If the value is greater than 2V then switch the LED on
jchari 3:b8aaacdd726e 17 pc.printf("Thermistor is being worn\r\n");
bcostm 1:0490a15c76e4 18 }
jchari 3:b8aaacdd726e 19 if (meas < 450) { // If the value is greater than 2V then switch the LED on
jchari 3:b8aaacdd726e 20 pc.printf("Thermistor is at room temperature\r\n");
bcostm 0:c2d1ad5059da 21 }
jchari 3:b8aaacdd726e 22 /*if (meas <= 500 && meas >= 450) { // If the value is greater than 2V then switch the LED on
jchari 3:b8aaacdd726e 23 pc.printf("Thermistor is in cloth\r\n");
jchari 3:b8aaacdd726e 24 }*/
jchari 3:b8aaacdd726e 25 wait(1); // 200 ms
bcostm 0:c2d1ad5059da 26 }
bcostm 0:c2d1ad5059da 27 }
nkadhikari 4:b4270fbde211 28
nkadhikari 4:b4270fbde211 29 //Nir changes ;asdkfj;kasdjfafklsdjfkljsdkljaf