MSS
/
test_HIH6130
test program for HIH6130, tested with MSS, MSU and FRDM-KL25Z
test_HIH6130.cpp@3:ea50121cc331, 2017-05-16 (annotated)
- Committer:
- Rhyme
- Date:
- Tue May 16 02:36:40 2017 +0000
- Revision:
- 3:ea50121cc331
- Parent:
- 2:c169837a0d3e
start_CM/start_NOM have been tested, but to reduce confusion, test part is removed.
Who changed what in which revision?
User | Revision | Line number | New 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 | 0:eb7b037f9295 | 9 | float humidity = 0 ; |
Rhyme | 0:eb7b037f9295 | 10 | float temperature = 0 ; |
Rhyme | 3:ea50121cc331 | 11 | |
Rhyme | 2:c169837a0d3e | 12 | hih6130 = new HIH6130(PIN_SDA, PIN_SCL, HIH6130_I2C_ADDRESS) ; |
Rhyme | 3:ea50121cc331 | 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 | 3:ea50121cc331 | 20 | 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 | } |