Get I2C working

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
Post Reply
Tealon
Posts: 2
Joined: Mon Jun 06, 2016 3:15 pm

Get I2C working

Post by Tealon » Mon Jun 06, 2016 3:24 pm

Although I'm a compleet n00b, I did get a BMP180 sensor working with an Arduino. When trying the same with the Wipy, I get stuck at the very beginning...

I connected the BMP180 sensor board from sparkfun on pin 10 and 11, and tried to run the following code:

from machine import I2C
# configure the I2C bus
i2c = I2C(0, I2C.MASTER, baudrate=100000)
i2c.scan() # returns list of slave addresses

The result I get is: [], which seems wrong :)

Can anybody help me what I'm doing wrong?

Tealon
Posts: 2
Joined: Mon Jun 06, 2016 3:15 pm

Re: Get I2C working

Post by Tealon » Mon Jun 06, 2016 8:45 pm

Nevermind, I got it working. I misread the way how to assign the pins yourself. This works:

>>> i2c_pins = ('GP11', 'GP10')
>>> i2c = I2C(I2C.MASTER, baudrate=100000, pins=i2c_pins)
>>> i2c.scan()
[119]

Post Reply