Search found 3 matches

by sashaks
Tue Apr 11, 2017 1:39 am
Forum: MicroPython pyboard
Topic: using tsl2561 light sensor with a pyboard
Replies: 11
Views: 10963

Re: using tsl2561 light sensor with a pyboard

Actually found the solution, you can manually designate the pyboard pins with -1 in the I2C function:
>>> import tsl2561
>>> from machine import Pin, I2C
>>> i2c = machine.I2C(-1, scl = machine.Pin('X9'), sda = machine.Pin('X10'), freq = 10000)
>>> sensor = tsl2561.TSL2561(i2c)
>>> sensor.read()
by sashaks
Mon Apr 10, 2017 5:47 pm
Forum: MicroPython pyboard
Topic: using tsl2561 light sensor with a pyboard
Replies: 11
Views: 10963

Re: using tsl2561 light sensor with a pyboard

Thank you - I am able to do that if I use pyb instead of machine and I get a little bit farther, but now I can't manage to get the tsl2561.py file to work. Currently I have: >>> import pyb >>> import tsl2561 >>> i2c = pyb.I2C(1, pyb.I2C.MASTER) >>> sensor = tsl2561.TSL2561(i2c) Traceback (most recen...
by sashaks
Fri Apr 07, 2017 6:29 am
Forum: MicroPython pyboard
Topic: using tsl2561 light sensor with a pyboard
Replies: 11
Views: 10963

using tsl2561 light sensor with a pyboard

Hello, I am trying to use a TSL2561 light sensor with a pyboard. I have previously used this sensor successfully with an ESP8266 using the following code: import tsl2561 from machine import I2C, Pin i2c = I2C(Pin(5), Pin(4)) sensor = tsl256.TSL2561(i2c) sensor.read() where 5 = scl and 4 = sda on the...