ADT7410 sample
Dependencies: ADT7410 BLE_API mbed nRF51822
Revision 7:a1e3e531e518, committed 2017-08-02
- Comitter:
- Jun_adi
- Date:
- Wed Aug 02 13:31:52 2017 +0000
- Parent:
- 6:84aa3914b00d
- Commit message:
- Update ADT7410 temp sensor value
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 84aa3914b00d -r a1e3e531e518 main.cpp --- a/main.cpp Thu Jul 13 08:00:48 2017 +0000 +++ b/main.cpp Wed Aug 02 13:31:52 2017 +0000 @@ -38,7 +38,7 @@ //Definition //------------------------------------------------------------ #define TXRX_BUF_LEN 20 //max 20[byte] -#define DEVICE_LOCAL_NAME "BlueJelly" +#define DEVICE_LOCAL_NAME "ADT7410 Temperature" //Change Device name #define ADVERTISING_INTERVAL 160 //160 * 0.625[ms] = 100[ms] #define TICKER_TIME 200000 //200000[us] = 200[ms] #define DIGITAL_OUT_PIN P0_9 @@ -113,18 +113,18 @@ //onTimeout //====================================================================== +/* void m_status_check_handle(void) { -/* uint8_t buf[2]; //Read Analog port float s = ANALOG; uint16_t value = s*1024; buf[0] = (value >> 8); buf[1] = value; -*/ } +*/ //====================================================================== //convert reverse UUID @@ -147,7 +147,7 @@ //Timer Setting [us] Ticker ticker; - ticker.attach_us(m_status_check_handle, TICKER_TIME); + //ticker.attach_us(m_status_check_handle, TICKER_TIME); //BLE init ble.init(); @@ -203,9 +203,10 @@ // get temperature every two seconds tempadt = temp.getTemp(); - uint16_t value = tempadt; - buf[0] = (value >> 8); - buf[1] = value; + int16_t value0 = tempadt; //Get integer value + int16_t value1 = (tempadt - value0)*100; //Get decimal value + buf[0] = value0; + buf[1] = value1; //Send out ble.updateCharacteristicValue(rxCharacteristic.getValueAttribute().getHandle(), buf, 2);