Using the I2C interface

Resources https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/i2c.html https://github.com/espressif/esp-idf/tree/master/examples/peripherals/i2c I2C Master Example #include "driver/i2c.h" #define EXAMPLE_I2C_PORT_NUMBER I2C_NUM_1 //I2C port number #define EXAMPLE_I2C_SCL_GPIO 16 //GPIO pin #define EXAMPLE_I2C_SDA_GPIO 17 //GPIO pin #define EXAMPLE_I2C_FREQ_HZ 100000 //!< I2C master clock frequency #define EXAMPLE_I2C_ADDR 0x98 #define EXAMPLE_I2C_WRITE_BIT I2C_MASTER_WRITE #define EXAMPLE_I2C_READ_BIT I2C_MASTER_READ #define EXAMPLE_I2C_ACK_CHECK_EN 0x1 #define EXAMPLE_I2C_ACK_CHECK_DIS 0x0 #define EXAMPLE_I2C_ACK_VAL 0x0 #define EXAMPLE_I2C_NACK_VAL 0x1 //—– CREATE […]

Read More