Hi to everybody,
i have been able to make it work, so i wold like to share with you all the process:
step 1 connect the robot to internet:
- take off the wifi dongle
- just connect to your router with a cable
step 2 install i2c tools and smbus
- to enable i2c follow this link:
http://skpang.co.uk/blog/archives/575step 3 check the i2c address of your device
- run sudo i2cdetect -y 1
I have the light sensor at address 0x28
then run a simple program, if you have the light sensor run mine below (just starting to program in python:
______________________________________
#!/usr/bin/python3
import time
import smbus
from smbus import SMBus
address = 0x29
control_on = 0x03
control_off = 0x00
TSL2561 = SMBus(1)
def enable ():
print "power ON"
TSL2561.write_byte(address, 0x80)
TSL2561.write_byte(address, control_on)
return
def disable():
print "power OFF"
TSL2561.write_byte(address, 0x80)
TSL2561.write_byte(address, control_off)
return
def Light():
var = [0,0,0,0]
var = TSL2561.read_i2c_block_data(0x29, 0x8C)
Channel0 = ((var[1]<<8) + var[0])
Channel1 = ((var[3]<<8) + var[2])
print "TOTAL LIGHT:%5d IR LIGHT:%5d" %(Channel0, Channel1)
return
def main():
enable()
while(True):
Light()
time.sleep(3)
if __name__=="__main__":
main()
_________________________________________
have fun...
big hugs from Italy
Beppe