ir = lum >> 16;// what does this mean cant get the syntax?
full = lum & 0xFFFF; //what does this mean cant get the syntax?
TSL2561 query
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 7
- Joined: Tue Aug 21, 2012 4:42 pm
Re: TSL2561 query
Also the sensor is giving me 0 luminosity. Even when the sensor is disconnected and i run the code it gives found sensor.
- adafruit_support_bill
- Posts: 88087
- Joined: Sat Feb 07, 2009 10:11 am
Re: TSL2561 query
That is a binary shift operation. It shifts the value right by 16 bits (equivalent to a divide by 65535)ir = lum >> 16;// 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.full = lum & 0xFFFF; //what does this mean cant get the syntax?
Post photos showing all your connections and we'll take a look.Also the sensor is giving me 0 luminosity. Even when the sensor is disconnected and i run the code it gives found sensor.
- tastewar
- Posts: 408
- Joined: Thu Mar 17, 2011 10:16 am
Re: TSL2561 query
Minor correction -- it's a divide by 65536.That is a binary shift operation. It shifts the value right by 16 bits (equivalent to a divide by 65535)ir = lum >> 16;// what does this mean cant get the syntax?
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.
- adafruit_support_bill
- Posts: 88087
- Joined: Sat Feb 07, 2009 10:11 am
Re: TSL2561 query
The I2C bus on an UNO is on analog pins 4 and 5. The correct wiring is:
http://learn.adafruit.com/tsl2561/wiring
http://learn.adafruit.com/tsl2561/wiring
-
- Posts: 7
- Joined: Tue Aug 21, 2012 4:42 pm
Re: TSL2561 query
Ooooooooooo. Thanks sorry my first I2C sensor.
Please be positive and constructive with your questions and comments.