Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: TSL2561.cpp
- Revision:
- 1:52b855c13204
- Parent:
- 0:a3cedb66846f
- Child:
- 2:c45d34e9c3f0
--- a/TSL2561.cpp Thu Jul 23 21:18:25 2015 +0000 +++ b/TSL2561.cpp Tue Aug 04 17:15:01 2015 +0000 @@ -62,20 +62,23 @@ bool TSL2561::begin(void) { + //float idf; uint16_t idu; char ID_REGISTER[1] = {TSL2561_REGISTER_ID}; i2c.write(address, ID_REGISTER, 1, true); char DATA[1] = {0}; i2c.read(address, DATA, 1, false); idu = DATA[0]; + //idf = (float)idu; - if (idu == 0x10) + if (idu & 0x0A) { - pc.printf("FOUND TSL2561\r\n"); + //pc.printf("FOUND TSL2561\r\n"); } else { - pc.printf("NOT FOUND TSL2561\r\n"); + //pc.printf("NOT FOUND TSL2561\r\n"); + //pc.printf("%4.0f ID\n",idf); return false; } _initialized = true; @@ -190,7 +193,7 @@ //round the ratio value unsigned long ratio = (ratio1 + 1) >> 1; - unsigned int b, m; + unsigned int b=0, m=0; //check which coefficients the ratio dictates