Page 1 of 1

Real Time serial connection (Write data to the board from 3rd party software

Posted: Mon Jul 30, 2018 4:29 pm
by meldiwin
Hello,

I am using micropython board pyb v1 and I am supposed to use it with another software SOFA framework for sending data to the board from SOFA, however, I found that rshell disconnects and sometimes doesnot work, I would be grateful if there is solution?.


Thanks,

Marwa

Re: Real Time serial connection (Write data to the board from 3rd party software

Posted: Mon Jul 30, 2018 5:32 pm
by dhylands
Note: that only one piece of software should have the serial port open at a time.

If rshell (or any other terminal program for that matter) has the serial port open and another program opens the serial port at the same time then some of the characters sent from the pyboard will go to rshell and some of the characters will go to the other program.

Re: Real Time serial connection (Write data to the board from 3rd party software

Posted: Mon Jul 30, 2018 7:38 pm
by meldiwin
Thanks for your reply! I understand this, but the problem how to define pyb board in python directly, I am using Pyserial, so how Pyb defined directly from my software which some part of it python code.

File "serialPortController.py", line 1, in <module>
from pyb import Pin
ImportError: No module named pyb

Re: Real Time serial connection (Write data to the board from 3rd party software

Posted: Mon Jul 30, 2018 9:05 pm
by dhylands
The pyb module is only available on the pyboard, not on the host side.

Re: Real Time serial connection (Write data to the board from 3rd party software

Posted: Fri Aug 03, 2018 4:58 pm
by meldiwin
For the moment, I can connect my third party software with micropython, however, I wasnot able to power even a lead because I have to write

pyb.LED(1).on()

I dont know how micropython board v1 can be communicated with other software, any solutions?

Re: Real Time serial connection (Write data to the board from 3rd party software

Posted: Fri Aug 03, 2018 5:19 pm
by dhylands
I wrote some software called json-ipc which sends json packets back and forth. You can find it here:
https://github.com/dhylands/json-ipc

You could have the host send a command to turn the LED on and the pyboard would execute the pyb.LED(1).on(). The pyb.LED(1).on() needs to executre from the python running on the pyboard and not the python running on the host.

Re: Real Time serial connection (Write data to the board from 3rd party software

Posted: Sun Aug 05, 2018 6:43 pm
by meldiwin
Thanks for your reply!. Now it seems that micro python doesnot have the same flexibility as arduino boards, as I need to run this on the python host as it is integrated with other parts of software. I would like to use micropython board, but this could be a dilemma as I cannot send commands from host directly.

Re: Real Time serial connection (Write data to the board from 3rd party software

Posted: Sun Aug 05, 2018 11:56 pm
by SpotlightKid
An Arduino board also can not directly execute "commands" from another host or any other computer, unless you program it with a firmware (sketch), which allows you to do just that, for example one based on the Firmata protcol. The one commonly used is called StandardFirmata.