test program for VEML6030
Dependencies: VEML6030 mbed vt100
main.cpp@1:31b0d73cfaf4, 2017-03-30 (annotated)
- Committer:
- Rhyme
- Date:
- Thu Mar 30 04:20:34 2017 +0000
- Revision:
- 1:31b0d73cfaf4
- Parent:
- 0:1f65c238e7e6
- Child:
- 2:e284a78127b7
setting power saving mode added
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Rhyme | 0:1f65c238e7e6 | 1 | #include "mbed.h" |
Rhyme | 0:1f65c238e7e6 | 2 | #include "MSS.h" |
Rhyme | 0:1f65c238e7e6 | 3 | #include "vt100.h" |
Rhyme | 0:1f65c238e7e6 | 4 | #include "VEML6030.h" |
Rhyme | 0:1f65c238e7e6 | 5 | |
Rhyme | 0:1f65c238e7e6 | 6 | #ifndef MSU_VEML6030_I2C_ADDRESS |
Rhyme | 0:1f65c238e7e6 | 7 | #define MSU_VEML6030_I2C_ADDRESS 0x10 |
Rhyme | 0:1f65c238e7e6 | 8 | #endif |
Rhyme | 0:1f65c238e7e6 | 9 | |
Rhyme | 0:1f65c238e7e6 | 10 | VEML6030 *veml6030 = 0 ; |
Rhyme | 0:1f65c238e7e6 | 11 | |
Rhyme | 0:1f65c238e7e6 | 12 | vt100 *tty = 0 ; |
Rhyme | 0:1f65c238e7e6 | 13 | |
Rhyme | 0:1f65c238e7e6 | 14 | int main(void) |
Rhyme | 0:1f65c238e7e6 | 15 | { |
Rhyme | 0:1f65c238e7e6 | 16 | uint16_t als, white ; |
Rhyme | 0:1f65c238e7e6 | 17 | |
Rhyme | 1:31b0d73cfaf4 | 18 | veml6030 = new VEML6030(PIN_SDA, PIN_SCL, MSU_VEML6030_I2C_ADDRESS) ; |
Rhyme | 1:31b0d73cfaf4 | 19 | veml6030->setALSConf(0x0000) ; |
Rhyme | 1:31b0d73cfaf4 | 20 | veml6030->setPowerSaving(0x0000) ; |
Rhyme | 0:1f65c238e7e6 | 21 | |
Rhyme | 0:1f65c238e7e6 | 22 | tty = new vt100() ; |
Rhyme | 0:1f65c238e7e6 | 23 | tty->cls() ; |
Rhyme | 0:1f65c238e7e6 | 24 | |
Rhyme | 0:1f65c238e7e6 | 25 | printf("=== VEML6030 test %s ===\n", __DATE__) ; |
Rhyme | 1:31b0d73cfaf4 | 26 | |
Rhyme | 0:1f65c238e7e6 | 27 | |
Rhyme | 0:1f65c238e7e6 | 28 | while(1) { |
Rhyme | 0:1f65c238e7e6 | 29 | als = veml6030->getALS() ; |
Rhyme | 0:1f65c238e7e6 | 30 | white = veml6030->getWHITE() ; |
Rhyme | 0:1f65c238e7e6 | 31 | printf("VEML6030 ALS: %d WHITE: %d\n", als, white) ; |
Rhyme | 0:1f65c238e7e6 | 32 | wait(1) ; |
Rhyme | 0:1f65c238e7e6 | 33 | } |
Rhyme | 0:1f65c238e7e6 | 34 | } |