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

Dependencies:   HIH6130 mbed

Committer:
Rhyme
Date:
Tue Apr 18 04:33:36 2017 +0000
Revision:
0:eb7b037f9295
Child:
2:c169837a0d3e
Commit before re-publish;

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 0:eb7b037f9295 6 int main() {
Rhyme 0:eb7b037f9295 7 uint16_t result = 0 ;
Rhyme 0:eb7b037f9295 8 float humidity = 0 ;
Rhyme 0:eb7b037f9295 9 float temperature = 0 ;
Rhyme 0:eb7b037f9295 10 HIH6130 hih(PIN_SDA, PIN_SCL, HIH6130_I2C_ADDRESS) ;
Rhyme 0:eb7b037f9295 11
Rhyme 0:eb7b037f9295 12 printf("=== test HIH6130 for %s (%s) ===\n", BOARD_NAME, __DATE__) ;
Rhyme 0:eb7b037f9295 13
Rhyme 0:eb7b037f9295 14 while(1) {
Rhyme 0:eb7b037f9295 15 result = hih.getValue(&humidity, &temperature) ;
Rhyme 0:eb7b037f9295 16 printf("Temp %.1f C Humidity %.1f %%\n", temperature, humidity) ;
Rhyme 0:eb7b037f9295 17 wait(1) ;
Rhyme 0:eb7b037f9295 18 }
Rhyme 0:eb7b037f9295 19 }