Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

dpgeorge
Copy link
Member

This PR adds support for hardware I2C on the esp32. Sample usage:

i2c = machine.I2C(0, freq=1000000) # uses default pins
i2c_1 = machine.I2C(1, scl=machine.Pin(4), sda=machine.Pin(5))
i2c.scan()

Only basic testing of this code has been done so far, but it seems to work.

@dpgeorge dpgeorge merged commit a293347 into micropython:master Jul 19, 2019
@dpgeorge
Copy link
Member Author

I did further testing of this PR and fixed a bug with the I2C driver initialisation, added some docs to the quickref, and merged it.

@dpgeorge dpgeorge deleted the esp32-hw-i2c branch July 19, 2019 06:51
@GianniDPC
Copy link

Aren't the default i2c pins for the ESP32 SCL = GPIO22 and SDA = GPIO21?

@dpgeorge
Copy link
Member Author

dpgeorge commented Aug 7, 2019

I don't think there are any official default pins, it really depends which board is being used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants