Motor 2040 serial control

I am looking to use the motor2040 to control 4 motors with encoders.

Ideally I would be able to control these motors from a remote system - so that I can monitor and control the rpm of each connected motor from a seperate system (whether that is via UART, USB, I2C…) - perhaps setting the board up as an I2C peripheral/slave device?

Does anyone know if this is possible? I think the answer might be “yes, but the code does not yet exist”?

It looks to me that if I know the encoder PPR I can, using the supplied libraries, output the RPM over the serial console…

There are I think only 2 analogue inputs broken out, but I could use one of them, on a potentiometer, coupled with the push button as a selector, to let a user change the target RPM…does that sound like it could work?

I might also be able to read a requested RPM from serial input…but haven’t looked int how yet!

yes, but the code does not yet exist ;)

I wrote some code for our Yukon board that let it receive commands over UART from a serial module and use them to be drive motors, so that may be worth you having a look at: yukon/examples/showcase/rover at main · pimoroni/yukon · GitHub

Otherwise, no, there is not some ready to go solution for your needs, particularly as everyone’s needs are slightly different.

No worries, it’s more fun to write it from scratch. Just wanted to make sure I wasn’t reinventing the wheel (pun intended)

Thanks for the suggestion - I’ll take a look now