Rasp Pico LCD wire.setSDA

I try everything (a lot of exemple and SDA SCL pin) to use LCD with rasp pico. Nothing work. With the lib LiquidCrystal_I2C, I have this error: 'class arduino::MbedI2C' has no member named 'setSDA'.

Here is the code:
'''
#include <Wire.h>

const byte PICO_I2C_ADDRESS = 0x55;
const byte PICO_I2C_SDA = 20;
const byte PICO_I2C_SCL = 21;
const byte PICO_LED = 25;

byte volatile rx_flag = 0;
byte volatile tx_flag = 0;
uint8_t volatile ram_addr = 0;
uint8_t volatile ram[256];

void setup() {
pinMode (PICO_LED, OUTPUT);
Wire.setSDA(PICO_I2C_SDA);
Wire.setSCL(PICO_I2C_SCL);
Wire.begin(PICO_I2C_ADDRESS); // join i2c bus as slave
Wire.onReceive(i2c_receive); // i2c interrupt receive
Wire.onRequest(i2c_transmit); // i2c interrupt send
}

void loop() {
if (rx_flag) {
rx_flag = 0;
digitalWrite (PICO_LED, HIGH);
delay(1);
digitalWrite (PICO_LED, LOW);
}

if (tx_flag) {
tx_flag = 0;
digitalWrite (PICO_LED, HIGH);
delay(1);
digitalWrite (PICO_LED, LOW);
}

delay(1);
}

void i2c_receive(int bytes_count) { // bytes_count gives number of bytes in rx buffer
if (bytes_count == 0) {
return;
}
ram_addr = (uint8_t)Wire.read(); // first byte is ram offset address (0-255)
for (byte i=1; i<bytes_count; i++) {
ram[ram_addr] = (uint8_t)Wire.read();
ram_addr++;
}
rx_flag = bytes_count;
}

void i2c_transmit() {
tx_flag = 1;
Wire.write((uint32_t)ram[ram_addr]);
ram_addr++;
}
'''

Please, someone have a working exemple with the right lib?

Daniel.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.