Page 1 of 1

Remote calling functions on micropython

Posted: Sat Aug 04, 2018 4:17 pm
by mgag
How can I call a function from the PC and execute on micropython?

I found this,
viewtopic.php?f=6&t=1020&hilit=pc+control&start=10

and a few references to this,
https://github.com/dhylands/json-ipc

I have a PC side Python application that needs to control the pyboard, and it seems silly to write a wrapper for every function in pyb.

Re: Remote calling functions on micropython

Posted: Sat Aug 04, 2018 11:59 pm
by dhylands
That's pretty much what you need to do.

You could use pyboard.py to send python code over.

You could also send python code to be executed via eval, although this isn't generally very secure.

Re: Remote calling functions on micropython

Posted: Sun Aug 05, 2018 6:35 pm
by mgag
Thanks Dave,

`That's pretty much what you need to do.`

Of the 3 possibilities that I mention, which one were you referring to?

I have no security requirements.

Martin

Re: Remote calling functions on micropython

Posted: Mon Aug 06, 2018 1:54 am
by dhylands
All of them are basically variations on the same theme. The host has no way of directly controlling peripherals on the mivropython board. You need to send something across a link and have the micropython board actually control the peripheral.

Re: Remote calling functions on micropython

Posted: Fri Oct 25, 2019 8:53 pm
by mgag
Here is a solution that others may find useful,

https://github.com/sistemicorp/p01-upyrpc