MSS
/
test_VCNL4100
test program for VCNL4100 proximity and ambient light sensor
Revision 1:ada96961855c, committed 2017-06-18
- Comitter:
- Rhyme
- Date:
- Sun Jun 18 23:52:26 2017 +0000
- Parent:
- 0:d0b4a6db65aa
- Commit message:
- Commit before publishing;
Changed in this revision
VCNL4100.lib | Show annotated file Show diff for this revision Revisions of this file |
test_VCNL4100.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r d0b4a6db65aa -r ada96961855c VCNL4100.lib --- a/VCNL4100.lib Mon May 08 07:18:28 2017 +0000 +++ b/VCNL4100.lib Sun Jun 18 23:52:26 2017 +0000 @@ -1,1 +1,1 @@ -VCNL4100#fbf1a72181fc +https://developer.mbed.org/teams/MSS/code/VCNL4100/#fbf1a72181fc
diff -r d0b4a6db65aa -r ada96961855c test_VCNL4100.cpp --- a/test_VCNL4100.cpp Mon May 08 07:18:28 2017 +0000 +++ b/test_VCNL4100.cpp Sun Jun 18 23:52:26 2017 +0000 @@ -8,12 +8,21 @@ DigitalOut myled(LED1); int main() { + uint8_t psData = 0x00 ; + uint16_t alsData = 0x00 ; vcnl4100 = new VCNL4100(PIN_SDA, PIN_SCL, MSU_VCNL4100_I2C_ADDRESS) ; + printf("=== test VCNL4100 for %s (%s)\n", BOARD_NAME, __DATE__) ; + printf("Proximity, Ambient Light\n") ; + + vcnl4100->setAlsConf(0x00) ; + vcnl4100->setPsConf12(0x0000) ; + vcnl4100->setSpo(0xA0) ; + while(1) { - myled = 1; - wait(0.2); - myled = 0; - wait(0.2); + psData = vcnl4100->getPsData() ; + alsData = vcnl4100->getAlsData() ; + printf("0x%02X, 0x%04X\n", psData, alsData) ; + wait(1); } }