Raspberry Pi Pico (RP2040) I2C Example with MicroPython and C/C++ | Digi-Key Electronics

Поділитися
Вставка
  • Опубліковано 16 жов 2024

КОМЕНТАРІ • 14

  • @KellyDiversified
    @KellyDiversified Рік тому

    Great speaker and explanation. Moves a little fast, but can always rewind and repeat - thanks!

  • @grantpeterson2524
    @grantpeterson2524 3 роки тому +1

    I just recently got my Pico from you guys about 2 months ago before this video was published. Love the clear but concise language and voice!

  • @MUHAMMADYAWARIFRAHEEM
    @MUHAMMADYAWARIFRAHEEM 3 роки тому +2

    Very informative video

  • @cattflap1447
    @cattflap1447 3 роки тому +1

    Excellent, thank you 😁

  • @peterbell4736
    @peterbell4736 6 місяців тому

    I find many tutorials for using pico as an i2c master (controller), but not a lot of help using pico as an i2c slave (responder).
    I'm aware of the library created by Don Perron (and the epmoyer derivative) but haven't had a great deal of success with it.
    I have control system using a network of RPis, and currently using chips such as the mcp23017 for i/o. I wish to replace the various i/o devices with picos.

  • @cstanford8046
    @cstanford8046 7 місяців тому

    Is the SCL really 400kHz? I measured 250kHz after looking at it on a logic analyzer.

  • @scienceofart9121
    @scienceofart9121 2 роки тому

    I have a question, where are the DEVID constant comes from ? My peripheral adress is 0x6c and it returns x01

  • @ariaas1096
    @ariaas1096 2 роки тому

    I want to run and get data from GY-271 with raspberry pi pico and I don't know how I must do it. It works with I2C. could you help, please?

  • @TheStrafendestroy
    @TheStrafendestroy Рік тому

    So I have looked at my i2c line with a logic analyzer and keep gettin g a setup to read followed by a NAK even though im trying to write to the device. I 100 percent have to right address for the device 102 for the EZO_RTD. I did not pull up my resistor in internally since i have them externally. Help would be appreciated I have been trying ti fix this for days
    void i2c_setup(int SDA, int SCL,uint clock_speed,i2c_inst_t* i2c_port)
    {
    i2c_init(i2c_port, clock_speed); // This example will use I2C0 on the default SDA(Pin 0) and SCL(Pin 1)
    gpio_set_function(SDA, GPIO_FUNC_I2C); // Serial Clock
    gpio_set_function(SCL, GPIO_FUNC_I2C); // Serial Data line
    gpio_pull_up(SDA);
    gpio_pull_up(SCL);
    }
    int main()
    {
    int SDA = 0;
    int SCL = 1;
    // Vairable for read and write blocks
    uint8_t rxbuff[40]; // Receiving Buffer
    const uint8_t command[2]= "r"; // Command
    int len_bytes_command = strlen(command);
    int max_length_receive_bytes = 40;
    uint8_t address = 102;


    // Enable USB UART so we can print status output
    stdio_init_all();
    i2c_setup(SDA,SCL,400*1000,i2c0);


    while(1)
    {
    int written = i2c_write_blocking(i2c0,address,command,1,false);
    sleep_ms(600);
    printf("Bytes:%d,Address: %d
    ",written,address);

    }
    return 0;
    }

  • @gorge9774
    @gorge9774 3 роки тому +1

    Hi, i get error that i could not communicate with ADXL343,
    I don't have an accelerometer as you so i changed ADXL343_ADDR to:
    ADXL343_ADDR = 0x4c, So it should work fine.
    I would be grateful if you could help me solve this problem
    By the way my accelerometer is Grove - MMA7660FC
    bytearray((DEVID,)) = b'\xe5'
    data = '\x00'