Hallo, ich hab einen TSL2671 (http://www.ams.com/eng/content/download/250323/976177/142397) auf einer Platine und probiere diesen zum Testen über einen Raspberry Pi anzusteuern. Die angeschlossene IR LED blinkt auch, aber ich schaff es nicht einen sinnvollen Wert aus dem Proximity Register zu lesen (der Wert ist fest auf 1023). Interessanter Weise habe ich zufällig rausgefunden, dass in den CLEAR und IR ADC Register, die eigentlich nur bei dem TSL2771 (http://www.taosinc.com/getfile.aspx?type=press&file=TSL2771-E27.pdf) existieren sollen, sinnvolle Werte stehen. Für den TSL2771 gibt es im Datenblatt auch einen Beispielcode (S. 17). Hier mein Python Code für den RPi
1 | #!/usr/bin/env python
|
2 | |
3 | import smbus |
4 | import time |
5 | |
6 | bus = smbus.SMBus(1) |
7 | irAddress = 0x39 |
8 | |
9 | def init(): |
10 | bus.write_byte_data(irAddress, 0, 0); |
11 | bus.write_byte_data(irAddress, 0x82, 0xFF) #set proximity integration time |
12 | bus.write_byte_data(irAddress, 0x83, 0xFF) #set wait time |
13 | bus.write_byte_data(irAddress, 0x8E, 0x03) #set pulse count |
14 | bus.write_byte_data(irAddress, 0x8F, 0x30) #100mA, diode channel 0 and 1 |
15 | bus.write_byte_data(irAddress, 0x80, 0x0F) #enable |
16 | time.sleep(0.012) |
17 | |
18 | |
19 | init() |
20 | while True: |
21 | print "Clear (not for 2671)" |
22 | print bus.read_word_data(irAddress, 0x94) |
23 | print "IR (not for 2671)" |
24 | print bus.read_word_data(irAddress, 0x96) |
25 | print "Prox" |
26 | print bus.read_word_data(irAddress, 0x98) #PDATA |
27 | print
|
28 | time.sleep(0.05) |
Freue mich schon auf Ideen