From 80593efd46dc8db9e3f63f9273b2ee5b4677e88d Mon Sep 17 00:00:00 2001 From: Samuel Date: Sat, 17 Jan 2026 14:38:03 +0100 Subject: [PATCH] =?UTF-8?q?I2C=20Slave=20configur=C3=A9=20pour=20la=20cart?= =?UTF-8?q?e=20Detection2023?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 09f819f..6667c99 100644 --- a/main.c +++ b/main.c @@ -17,8 +17,8 @@ static const uint I2C_BAUDRATE = 100000; // 100 kHz #ifdef i2c_default // For this example, we run both the master and slave from the same board. // You'll need to wire pin GP4 to GP6 (SDA), and pin GP5 to GP7 (SCL). -static const uint I2C_SLAVE_SDA_PIN = PICO_DEFAULT_I2C_SDA_PIN; // 4 -static const uint I2C_SLAVE_SCL_PIN = PICO_DEFAULT_I2C_SCL_PIN; // 5 +static const uint I2C_SLAVE_SDA_PIN = 19; // 4 +static const uint I2C_SLAVE_SCL_PIN = 18; // 5 static const uint I2C_MASTER_SDA_PIN = 6; static const uint I2C_MASTER_SCL_PIN = 7; @@ -70,9 +70,9 @@ static void setup_slave() { gpio_set_function(I2C_SLAVE_SCL_PIN, GPIO_FUNC_I2C); gpio_pull_up(I2C_SLAVE_SCL_PIN); - i2c_init(i2c0, I2C_BAUDRATE); - // configure I2C0 for slave mode - i2c_slave_init(i2c0, I2C_SLAVE_ADDRESS, &i2c_slave_handler); + i2c_init(i2c1, I2C_BAUDRATE); + // configure I2C1 for slave mode + i2c_slave_init(i2c1, I2C_SLAVE_ADDRESS, &i2c_slave_handler); } #endif