test program for HDC1000

Dependencies:   HDC1000 mbed

Revision:
1:03353fe864df
Parent:
0:655618676da2
--- a/main.cpp	Mon Apr 17 02:49:51 2017 +0000
+++ b/main.cpp	Tue Apr 18 02:46:18 2017 +0000
@@ -8,46 +8,31 @@
 
 int main() {
     float temp, hume ;
-    uint16_t device_id, manufacture_id ;
-    uint16_t utemp, uhume ;
-    uint16_t conf = 0 ;
+    uint16_t dev_id, man_id ;
     int mode = 0 ;
-    
+
     hdc1000 = new HDC1000(PIN_SDA, PIN_SCL, PIN_INT0, HDC1000_I2C_ADDRESS) ;
-//    hdc1000 = new HDC1000(PIN_SDA, PIN_SCL, HDC1000_I2C_ADDRESS) ;
     hdc1000->reset() ;
-    wait(2) ;
-    conf = 0x0000 ;
-    hdc1000->setConfig(conf) ;
-    conf = 0x1000 ;
-    hdc1000->setConfig(conf) ;
-    conf = hdc1000->getConfig() ;
-    printf("Config = 0x%04X\n", conf) ;
+    wait(1) ;
     
-    device_id = hdc1000->getDeviceID() ;
-    printf("Device ID = 0x%04X\n", device_id) ;
-    manufacture_id = hdc1000->getManufactureID() ;
-    printf("Manufacture ID = 0x%04X\n", manufacture_id) ;
     printf("=== test HDC1000 for %s (%s) ===\n", BOARD_NAME, __DATE__) ;
-    mode = 0 ;
-    printf("mode = %d\n", mode) ;
-    hdc1000->setMode(mode) ;
+    dev_id = hdc1000->getDeviceID() ;
+    printf("Device      ID = 0x%04X\n", dev_id) ;
+    man_id = hdc1000->getManufactureID() ;
+    printf("Manufacture ID = 0x%04X\n", man_id) ;
 
     while(1) {
-        printf("mode = %d\n", mode) ;
+        printf("mode = %d ", mode) ;
         hdc1000->setMode(mode) ;
         wait(1) ;
         if (mode == 1) {
             hdc1000->readData(&temp, &hume) ;
-            printf("Temperature:%.2f C  Humidity:%.2f %%\n",temp, hume) ;
         } else {
             temp = hdc1000->readTemperature() ;
             hume = hdc1000->readHumidity() ;
-            
-            printf("Temperature: %.2f ", temp) ;
-            printf("Humidity: %.2f%%\n", hume) ;
         }
-        wait(2) ;
+        printf("Temperature: %.2f C  Humidity: %.2f %%\n",temp, hume) ;
+        wait(1) ;
         mode = (mode == 0) ? 1 : 0 ;
     }
 }