DesignForAmputee hw 5 project

Dependencies:   mbed BLE_API nRF51822

Revision:
8:114fea2afa09
Parent:
7:fa5a3ca3c62b
Child:
10:0193462ea6f1
--- a/main.cpp	Sat Nov 08 02:01:45 2014 +0000
+++ b/main.cpp	Sat Nov 08 02:27:42 2014 +0000
@@ -34,7 +34,10 @@
 void onDataWritten(const GattCharacteristicWriteCBParams *params)
 {
     if ((uartServicePtr != NULL) && (params->charHandle == uartServicePtr->getTXCharacteristicHandle())) {
-        float temp = ((tempPin.read()*3)-0.5)*100; // temperature, conversion to celcius, via https://learn.adafruit.com/tmp36-temperature-sensor?view=all
+        float temp = tempPin.read(); // temperature voltage
+
+        float tempC = ((temp*3)-0.5)*100; // conversion to celcius
+        float tempF = (tempC*9/5)+32;                 // conversion to fahrenheit
 
         uint16_t bytesRead = params->len;
         DEBUG("received %u bytes\n\r", bytesRead);
@@ -49,6 +52,8 @@
             powerSwitch = 0;
         }
         ble.updateCharacteristicValue(uartServicePtr->getRXCharacteristicHandle(), params->data, bytesRead);
+        //ble.updateCharacteristicValue(uartServicePtr->getRXCharacteristicHandle(), (uint8_t*)&tempF, sizeof(tempF));
+
     }
 }