TSL2561 query

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
tusshar
 
Posts: 7
Joined: Tue Aug 21, 2012 4:42 pm

TSL2561 query

Post by tusshar »

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

Post by tusshar »

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

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: TSL2561 query

Post by adafruit_support_bill »

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.

User avatar
tastewar
 
Posts: 408
Joined: Thu Mar 17, 2011 10:16 am

Re: TSL2561 query

Post by tastewar »

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.

tusshar
 
Posts: 7
Joined: Tue Aug 21, 2012 4:42 pm

Re: TSL2561 query

Post by tusshar »

Posting Pics...
WP_000324.jpg
WP_000324.jpg (405.38 KiB) Viewed 1581 times
WP_000323.jpg
WP_000323.jpg (501.97 KiB) Viewed 1581 times

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: TSL2561 query

Post by adafruit_support_bill »

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

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

Image

tusshar
 
Posts: 7
Joined: Tue Aug 21, 2012 4:42 pm

Re: TSL2561 query

Post by tusshar »

Ooooooooooo. :| Thanks sorry my first I2C sensor.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”