DEV Community

Discussion on: Using I2C in MicroPython 🌡

Collapse
 
fivdi profile image
Brian Cooke

Hi, nice post :)

There may be a misunderstanding related to the deprecation of hardware I2C in MicroPython as hardware I2C hasn’t actually been deprecated.

The post doesn't explicitly mention what warning message related to I2C was seen, but assuming it was "Warning: I2C(-1, ...) is deprecated, use SoftI2C(...) instead", this means that the syntax I2C(-1, ...) which actually creates a SoftI2C instance has been deprecated. To create a SoftI2C instance the syntax SoftI2C(...) should now be used instead.

To create an I2C instance for hardware I2C on the ESP32-C3, the syntax I2C(0, ...) should be used. The 0 here identifies the hardware I2C peripheral.

Collapse
 
andypiper profile image
Andy Piper

This is great, thanks for clarifying! I’ll try this over again :-)