DesignForAmputee hw 5 project

Dependencies:   mbed BLE_API nRF51822

main.cpp

Committer:
jstroud
Date:
2014-11-09
Revision:
9:22fe2c5a62ba
Parent:
5:46dd21736d36

File content as of revision 9:22fe2c5a62ba:

#include "mbed.h"

DigitalOut myled(LED1);
DigitalOut power(P0_0); // brown

AnalogIn tempPin(P0_1); // purple
float temp;
Serial pc(USBTX, USBRX);


int main() {
    power = 1;
    while(1) {
        myled = 1;
        //power = 1;
        wait(0.5);
        //power = 0;
        myled = 0;
        wait(0.2);
        //power = 1;
        temp = tempPin.read();
        float tempC = ((temp*3.0)-0.5)*100.0; // conversion to celcius
        float tempF = (tempC*9.0/5.0)+32.0;                 // conversion to fahrenheit
        pc.printf("test\n");
        pc.printf("\ntemp[V]:%f\ttemp[C]:%f\ttemp[F]:%f\t",temp,tempC,tempF);
        //if(temp > 0.5)
        //    power = 1;
    }
}