Memorial day is 05/25/2015 – Orders will ship out on May 26th. There will not be any deliveries or shipping on Monday. Any order placed after 11am ET on Friday May 22nd will not start to ship out until Tuesday May 26th.

TSL2561 query
Moderators: adafruit_support_bill, adafruit

TSL2561 query

by tusshar on Tue Dec 04, 2012 5:49 am

ir = lum >> 16;// what does this mean cant get the syntax?

full = lum & 0xFFFF; //what does this mean cant get the syntax?
tusshar
 
Posts: 7
Joined: Tue Aug 21, 2012 4:42 pm

Re: TSL2561 query

by tusshar on Tue Dec 04, 2012 6:07 am

Also the sensor is giving me 0 luminosity. Even when the sensor is disconnected and i run the code it gives found sensor.
tusshar
 
Posts: 7
Joined: Tue Aug 21, 2012 4:42 pm

Re: TSL2561 query

by adafruit_support_bill on Tue Dec 04, 2012 7:43 am

ir = lum >> 16;// what does this mean cant get the syntax?

That is a binary shift operation. It shifts the value right by 16 bits (equivalent to a divide by 65535)

full = lum & 0xFFFF; //what does this mean cant get the syntax?

That is a binary masking operation using a logical AND (&). It masks off everything but the low order 16 bits.

Also the sensor is giving me 0 luminosity. Even when the sensor is disconnected and i run the code it gives found sensor.

Post photos showing all your connections and we'll take a look.

adafruit_support_bill
 
Posts: 37539
Joined: Sat Feb 07, 2009 10:11 am

Re: TSL2561 query

by tastewar on Tue Dec 04, 2012 10:48 am

ir = lum >> 16;// what does this mean cant get the syntax?

That is a binary shift operation. It shifts the value right by 16 bits (equivalent to a divide by 65535)


Minor correction -- it's a divide by 65536.

Seems like lum is a 32-bit variable that really contains 2 16-bit "fields" of information: the upper 16 bits would appear to encode ir luminosity, and the lower 16 bits would appear to encode full spectrum luminosity. (This is what I infer from the code and no other context -- could be complete BS...) The two operations are intended to isolate those two numbers into their own variables.
tastewar
 
Posts: 353
Joined: Thu Mar 17, 2011 10:16 am

Re: TSL2561 query

by tusshar on Wed Dec 05, 2012 2:44 am

Posting Pics...

WP_000324.jpg
WP_000324.jpg (405.38 KiB) Viewed 533 times
WP_000323.jpg
WP_000323.jpg (501.97 KiB) Viewed 533 times
tusshar
 
Posts: 7
Joined: Tue Aug 21, 2012 4:42 pm

Re: TSL2561 query

by adafruit_support_bill on Wed Dec 05, 2012 7:22 am

The I2C bus on an UNO is on analog pins 4 and 5. The correct wiring is:

http://learn.adafruit.com/tsl2561/wiring

Image

adafruit_support_bill
 
Posts: 37539
Joined: Sat Feb 07, 2009 10:11 am

Re: TSL2561 query

by tusshar on Wed Dec 05, 2012 11:14 am

Ooooooooooo. :| Thanks sorry my first I2C sensor.
tusshar
 
Posts: 7
Joined: Tue Aug 21, 2012 4:42 pm