program to test the veml7700 class to readout the veml7700 light sensor via i2c
Dependencies: mbed DevInterfaces I2Cinterfaces VEML7700
Revision 1:2de7e66b1757, committed 2019-09-10
- Comitter:
- wbeaumont
- Date:
- Tue Sep 10 13:33:48 2019 +0000
- Parent:
- 0:37c7223b15ea
- Commit message:
- added lux output
Changed in this revision
VEML7700.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 37c7223b15ea -r 2de7e66b1757 VEML7700.lib --- a/VEML7700.lib Tue Sep 10 11:20:56 2019 +0000 +++ b/VEML7700.lib Tue Sep 10 13:33:48 2019 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/users/wbeaumont/code/VEML7700/#e71d3ecdd257 +https://os.mbed.com/users/wbeaumont/code/VEML7700/#d6eb62dc0a1e
diff -r 37c7223b15ea -r 2de7e66b1757 main.cpp --- a/main.cpp Tue Sep 10 11:20:56 2019 +0000 +++ b/main.cpp Tue Sep 10 13:33:48 2019 +0000 @@ -11,7 +11,7 @@ * https://github.com/wimbeaumont/PeripheralDevices/blob/master/LICENSE */ -#define VEML7700EXAMPLEVER "1.56" +#define VEML7700EXAMPLEVER "1.62" #ifdef __MBED__ @@ -83,7 +83,7 @@ luxm.set_integrationtime(1000); // > max float gain=.125;//default - bool sd ,ie; u16 pers_protect;int IntT=8; float gainrb; + bool sd ,ie; u16 reg, pers_protect;int IntT=8; float gainrb; while ( 1) { int alsbits = luxm.get_als_bits ( ); err=luxm.get_status( ); @@ -108,17 +108,17 @@ } // else min gain } } // else if err - int whitebits = luxm.get_white_ch_bits ( ); + float white = luxm.get_lux (false );// get the white ch in lux if( err) { printf("get error %d after get white init \n\r", err); } - luxm.decode_Reg0( sd , ie, pers_protect, IntT, gainrb ); + reg = luxm.decode_Reg0( sd , ie, pers_protect, IntT, gainrb ); err=luxm.get_status( ); if( err) { printf("get error %d after read cmd reg \n\r", err); } - printf( " als %04x , white %04x @gain %f reg0: sd %d, ie %d , Pers_prot %d, IntT %d, gain %f \n\r", - alsbits, whitebits,gain,(int) sd ,(int) ie,(int) pers_protect, IntT, gainrb ); + printf( " als %04x , white %f @gain %f reg0 %04x: sd %d, ie %d , P_prot %d, IT %d, G %f \n\r", + alsbits, white,gain,reg, (int) sd ,(int) ie,(int) pers_protect, IntT, gainrb ); i2cdev->wait_for_ms(1000); } return 1;