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

Dependencies:   HIH6130 mbed

test_HIH6130.cpp

Committer:
Rhyme
Date:
2017-05-16
Revision:
2:c169837a0d3e
Parent:
0:eb7b037f9295
Child:
3:ea50121cc331

File content as of revision 2:c169837a0d3e:

#include "mbed.h"
#include "MSS.h"
#include "HIH6130.h"
#define HIH6130_I2C_ADDRESS (0x27)

HIH6130 *hih6130 = 0 ;

int main() {
    uint16_t status = 0 ;
    float humidity = 0 ;
    float temperature = 0 ;
    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) {
        hih6130->measure() ;
        wait(0.5) ;
        status = hih6130->getValue(&humidity, &temperature) ;
        printf("%.1f, %.1f\n", temperature, humidity) ;      
        wait(1) ;
    }
}