test program for HIH6130, tested with MSS, MSU and FRDM-KL25Z

Dependencies:   HIH6130 mbed

Committer:
Rhyme
Date:
Tue May 16 01:37:25 2017 +0000
Revision:
2:c169837a0d3e
Parent:
0:eb7b037f9295
Child:
3:ea50121cc331
format updated to be compatible with CSV

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rhyme 0:eb7b037f9295 1 #include "mbed.h"
Rhyme 0:eb7b037f9295 2 #include "MSS.h"
Rhyme 0:eb7b037f9295 3 #include "HIH6130.h"
Rhyme 0:eb7b037f9295 4 #define HIH6130_I2C_ADDRESS (0x27)
Rhyme 0:eb7b037f9295 5
Rhyme 2:c169837a0d3e 6 HIH6130 *hih6130 = 0 ;
Rhyme 2:c169837a0d3e 7
Rhyme 0:eb7b037f9295 8 int main() {
Rhyme 2:c169837a0d3e 9 uint16_t status = 0 ;
Rhyme 0:eb7b037f9295 10 float humidity = 0 ;
Rhyme 0:eb7b037f9295 11 float temperature = 0 ;
Rhyme 2:c169837a0d3e 12 hih6130 = new HIH6130(PIN_SDA, PIN_SCL, HIH6130_I2C_ADDRESS) ;
Rhyme 0:eb7b037f9295 13
Rhyme 0:eb7b037f9295 14 printf("=== test HIH6130 for %s (%s) ===\n", BOARD_NAME, __DATE__) ;
Rhyme 2:c169837a0d3e 15 printf("Temperature(c), Humidity(%%)\n") ;
Rhyme 0:eb7b037f9295 16
Rhyme 0:eb7b037f9295 17 while(1) {
Rhyme 2:c169837a0d3e 18 hih6130->measure() ;
Rhyme 2:c169837a0d3e 19 wait(0.5) ;
Rhyme 2:c169837a0d3e 20 status = hih6130->getValue(&humidity, &temperature) ;
Rhyme 2:c169837a0d3e 21 printf("%.1f, %.1f\n", temperature, humidity) ;
Rhyme 0:eb7b037f9295 22 wait(1) ;
Rhyme 0:eb7b037f9295 23 }
Rhyme 0:eb7b037f9295 24 }