TSL2561 query

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

TSL2561 query

Postby Tusshar » Tue Dec 04, 2012 4: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 3:42 pm

Re: TSL2561 query

Postby Tusshar » Tue Dec 04, 2012 5: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 3:42 pm

Re: TSL2561 query

Postby adafruit_support_bill » Tue Dec 04, 2012 6: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.
User avatar
adafruit_support_bill
 
Posts: 16017
Joined: Sat Feb 07, 2009 9:11 am

Re: TSL2561 query

Postby tastewar » Tue Dec 04, 2012 9: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: 204
Joined: Thu Mar 17, 2011 9:16 am

Re: TSL2561 query

Postby Tusshar » Wed Dec 05, 2012 1:44 am

Posting Pics...

WP_000324.jpg
WP_000324.jpg (405.38 KiB) Viewed 377 times
WP_000323.jpg
WP_000323.jpg (501.97 KiB) Viewed 377 times
Tusshar
 
Posts: 7
Joined: Tue Aug 21, 2012 3:42 pm

Re: TSL2561 query

Postby adafruit_support_bill » Wed Dec 05, 2012 6: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
User avatar
adafruit_support_bill
 
Posts: 16017
Joined: Sat Feb 07, 2009 9:11 am

Re: TSL2561 query

Postby Tusshar » Wed Dec 05, 2012 10:14 am

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


Return to General Project help

Who is online

Users browsing this forum: mibignistinly and 13 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [102]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[109]
 
Wireless[14]
Cables[60]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]