BLE_HTS_Demo

This BLE_HTS_Demo program enables you to collect Temperature and Humidity data reading from sensor and transmit to collector device such as smartphone.

Below documents teach you how to install app that can connect and read data from our DELTA-DFCM-NNN40 development board. There are two versions, Android and iPhone.

/media/uploads/Marcomissyou/ios_app_for_environment_sensor_0518.pdf

/media/uploads/Marcomissyou/android_app_for_environment_sensor.pdf

Revision:
7:c6c5ba871c2d
Parent:
5:5f9bc8b53db9
Child:
8:4653319ba675
--- a/main.cpp	Fri Aug 14 09:14:49 2015 +0000
+++ b/main.cpp	Fri Oct 21 02:27:42 2016 +0000
@@ -28,7 +28,6 @@
 BLEDevice  ble;
  
 DigitalOut  led1(LED1);
-DigitalOut  led2(LED2);
 
 static const uint8_t UUID_HUMI_AND_UVI[] = {0xf5, 0x59, 0xa2, 0x49, 0xbe, 0xb1, 0x4c, 0x54, 0xa1, 0x0a, 0xc7, 0x95, 0x7e, 0x17, 0xf8, 0x67};
 uint8_t wrs_HumiUVI_payload[11] = {0, };
@@ -62,7 +61,7 @@
 */
 /**************************************************************************/
 //
-void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason)
+void disconnectionCallback(const Gap::DisconnectionCallbackParams_t *params)
 {
     ble.startAdvertising();
 }
@@ -83,14 +82,10 @@
 
 int main(void)
 {
-    nrf_gpio_cfg_output(19);    // SWIO 
-    nrf_gpio_pin_clear(19);
     
-    if (hts221_init() & uvis25_init()) 
-    {   led2=1;
-    }
-    
-    
+    hts221_init();
+    uvis25_init(); 
+
     HTS221_Calib();
     
     Ticker ticker;
@@ -116,13 +111,19 @@
     
     while (true) {
 
-            HTS221_ReadTempHumi(&tempCelsius, &humi);
-            
-            if(uvis25_verify_product_id()){
+            if(hts221_verify_product_id())
+                HTS221_ReadTempHumi(&tempCelsius, &humi);
+            else {
+                //show dummy value
+                tempCelsius = 100;
+                humi = 100;
+            }
+                
+            if(uvis25_verify_product_id())
                 uvi = UVIS25_ReadUVI();
-            } else {
+            else
                 uvi = 100;  //Environment Sensor APP will show NO UV DEVICE.
-                }
+        
             /* Update the Temperature measurement */
             /* See --> https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.temperature_measurement.xml */
             tempCelsius_ix100 = tempCelsius * 100;