Hello to the whole micropython community!
I am a student and have a micropyhton project with my classmates.
Our project is to control motors with the Pyboard, however the pyboard needs information (information relating to the time during which a motor must be running). This information are obtained from a Python program on a computer that uses a module called "OpenCV".
Here is our problem:
We would like the pyboard to ask the computer to run a Python program (using the OpenCv module). This program will send information back to the pyboard.
Subsequently, this information will allow the Pyboard to control the motors.
Additional information:
- We use Upycraft to communicate with the pyboard.
- We are beginners in micropython.
Thank you in advance for your reply
How a pyboard can request the runnig of a program on a computer ?
Re: How a pyboard can request the runnig of a program on a computer ?
This is a very non-specific answer, but you could look at pyb.USB_VCP() and set up some flavor of two-way communication between the host computer and the pyboard.
https://docs.micropython.org/en/latest/ ... B_VCP.html
https://docs.micropython.org/en/latest/ ... B_VCP.html
Re: How a pyboard can request the runnig of a program on a computer ?
Thank you Mathieu,
We took a good look at what you sent us. We are still beginners, so we did not understand the content of the link. If someone could give us more information or even suggest another method (more precise if possible). We are open to all proposals !
We took a good look at what you sent us. We are still beginners, so we did not understand the content of the link. If someone could give us more information or even suggest another method (more precise if possible). We are open to all proposals !
Re: How a pyboard can request the runnig of a program on a computer ?
There is no way for Micropython to run anything on the PC.
You can run a program on the PC which listens for requests and have that program on the PC run it on behalf of Micropython.
There are any number of ways for that micropython can communicate with the PC. The USB port basical;y looks like a serial link, so you can use pretty much any serial communications protocol you'd like.
I wrote one that uses JSON to communicate back and forth. See https://github.com/dhylands/json-ipc
The stm_usb_port.py file uses pyb.USB_VCP that a previous post was referring to.
You can run a program on the PC which listens for requests and have that program on the PC run it on behalf of Micropython.
There are any number of ways for that micropython can communicate with the PC. The USB port basical;y looks like a serial link, so you can use pretty much any serial communications protocol you'd like.
I wrote one that uses JSON to communicate back and forth. See https://github.com/dhylands/json-ipc
The stm_usb_port.py file uses pyb.USB_VCP that a previous post was referring to.