MSS
/
test_HIH6130
test program for HIH6130, tested with MSS, MSU and FRDM-KL25Z
Diff: test_HIH6130.cpp
- Revision:
- 2:c169837a0d3e
- Parent:
- 0:eb7b037f9295
- Child:
- 3:ea50121cc331
--- a/test_HIH6130.cpp Thu May 11 08:26:07 2017 +0000 +++ b/test_HIH6130.cpp Tue May 16 01:37:25 2017 +0000 @@ -3,17 +3,22 @@ #include "HIH6130.h" #define HIH6130_I2C_ADDRESS (0x27) +HIH6130 *hih6130 = 0 ; + int main() { - uint16_t result = 0 ; + uint16_t status = 0 ; float humidity = 0 ; float temperature = 0 ; - HIH6130 hih(PIN_SDA, PIN_SCL, HIH6130_I2C_ADDRESS) ; + hih6130 = new HIH6130(PIN_SDA, PIN_SCL, HIH6130_I2C_ADDRESS) ; printf("=== test HIH6130 for %s (%s) ===\n", BOARD_NAME, __DATE__) ; + printf("Temperature(c), Humidity(%%)\n") ; while(1) { - result = hih.getValue(&humidity, &temperature) ; - printf("Temp %.1f C Humidity %.1f %%\n", temperature, humidity) ; + hih6130->measure() ; + wait(0.5) ; + status = hih6130->getValue(&humidity, &temperature) ; + printf("%.1f, %.1f\n", temperature, humidity) ; wait(1) ; } }