Remote calling functions on micropython

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
mgag
Posts: 2
Joined: Sat Aug 04, 2018 4:07 pm

Remote calling functions on micropython

Post by mgag » Sat Aug 04, 2018 4:17 pm

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.

User avatar
dhylands
Posts: 2853
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Remote calling functions on micropython

Post by dhylands » Sat Aug 04, 2018 11:59 pm

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.

mgag
Posts: 2
Joined: Sat Aug 04, 2018 4:07 pm

Re: Remote calling functions on micropython

Post by mgag » Sun Aug 05, 2018 6:35 pm

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

User avatar
dhylands
Posts: 2853
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Remote calling functions on micropython

Post by dhylands » Mon Aug 06, 2018 1:54 am

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.

Post Reply