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

Files at this revision

API Documentation at this revision

Comitter:
Marcomissyou
Date:
Wed Jun 10 08:20:50 2015 +0000
Parent:
2:13ffe50056f9
Child:
4:27c7a3eadc42
Commit message:
detecting whether there is a UV sensor on board.; if no UV sensor returns 100.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Jun 10 02:04:48 2015 +0000
+++ b/main.cpp	Wed Jun 10 08:20:50 2015 +0000
@@ -27,7 +27,8 @@
 
 BLEDevice  ble;
  
-DigitalOut  led0(p7);
+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, };
@@ -68,7 +69,7 @@
 
 void periodicCallback(void)
 {
-    led0 = !led0; /* Do blinky on LED1 while we're waiting for BLE events */
+    led1 = !led1; /* Do blinky on LED1 while we're waiting for BLE events */
 
     /* Note that the periodicCallback() executes in interrupt context, so it is safer to do
      * heavy-weight sensor polling from the main thread. */
@@ -85,8 +86,11 @@
     nrf_gpio_cfg_output(19);    // SWIO 
     nrf_gpio_pin_clear(19);
     
-    if (hts221_init() ) //led2=1;
-//    else led2=0;
+    if (hts221_init() & uvis25_init()) 
+    {   led2=1;
+    }
+    
+    
     HTS221_Calib();
     
     Ticker ticker;
@@ -113,7 +117,12 @@
     while (true) {
 
             HTS221_ReadTempHumi(&tempCelsius, &humi);
-            uvi = UVIS25_ReadUVI();
+            
+            if(uvis25_verify_product_id()){
+                uvi = UVIS25_ReadUVI();
+            } 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;