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

Dependencies:   HIH6130 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers test_HIH6130.cpp Source File

test_HIH6130.cpp

00001 #include "mbed.h"
00002 #include "MSS.h"
00003 #include "HIH6130.h"
00004 #define HIH6130_I2C_ADDRESS (0x27)
00005 
00006 HIH6130 *hih6130 = 0 ;
00007 
00008 int main() {
00009     float humidity = 0 ;
00010     float temperature = 0 ;
00011     
00012     hih6130 = new HIH6130(PIN_SDA, PIN_SCL, HIH6130_I2C_ADDRESS) ;
00013         
00014     printf("=== test HIH6130 for %s (%s) ===\n", BOARD_NAME, __DATE__) ;
00015     printf("Temperature(c), Humidity(%%)\n") ;
00016     
00017     while(1) {
00018         hih6130->measure() ;
00019         wait(0.5) ;
00020         hih6130->getValue(&humidity, &temperature) ;
00021         printf("%.1f, %.1f\n", temperature, humidity) ;      
00022         wait(1) ;
00023     }
00024 }