5

I want my Raspberry Pi to control my Raspberry Pico. I'm trying to send bytes of data to the pico and then read the data on the pico so that I can take different actions depending on the data sent (e.g. turn different lights on or off).

I'm new to the world of Pi and I have not managed to find a simple example which points me in the right direction. However, it looks like I should be able to use I2C to achieve what I want.

Is it possible to set the Pico up as an I2C slave with any existing python libraries?

I've tried the following micropython code on the pico, but it doesn't show up as a slave on the Pi.

from machine import I2C, Pin
my_pico = IC2(0, scl=Pin(1), sda=Pin(0))

The Pico SDK docs mentions i2c_set_slave_mode, so I guess I'm looking for some way to use that via python.

pcoates
  • 153
  • 1
  • 5

1 Answers1

4

I googled and find this Pico I2C Slave class in microPython: i2cSlave.py.

Use Pico as an I2C slave? - danjperron, rpi.org.forums, 2021feb20

tlfong01
  • 4,847
  • 3
  • 12
  • 24