Passing array to Python Script

Technical discussions around xCORE processors (e.g. xcore-200 & xcore.ai).
Post Reply
User avatar
asid61
Active Member
Posts: 36
Joined: Sat May 31, 2014 6:39 am
Contact:

Passing array to Python Script

Post by asid61 »

I am reading a bunch of ADCs using the XMOS Startkit, and printing the values in realtime to the console window using xScope. I need to access the ADC data from Blender, a digital modeling program. Blender allows the use of Python programs to move/ control models in response to inputs. What is a good way to pass the values I see in the Composer console window to the Python program (which is running in Blender)?


User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm
Contact:

Post by Bianco »

Did you try the xScope socket interface?
User avatar
asid61
Active Member
Posts: 36
Joined: Sat May 31, 2014 6:39 am
Contact:

Post by asid61 »

Bianco wrote:Did you try the xScope socket interface?
I haven't heard anything about that. Is there a tutorial somewhere I can look at? I couldn't find anything about sockets in the xScope Support section.
User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm
Contact:

Post by Bianco »

I don't know about the xtimecomposer studio but on the command line you can try something like this:

xrun --xscope --xscope-realtime --xscope-port ip:port myapp.xe

I believe xscope implements a client TCP socket, so you will need to implement a server socket at the python side.

I haven't tried this yet.
User avatar
asid61
Active Member
Posts: 36
Joined: Sat May 31, 2014 6:39 am
Contact:

Post by asid61 »

Bianco wrote:I don't know about the xtimecomposer studio but on the command line you can try something like this:

xrun --xscope --xscope-realtime --xscope-port ip:port myapp.xe

I believe xscope implements a client TCP socket, so you will need to implement a server socket at the python side.

I haven't tried this yet.
Thank you for the information about the command line! I learn C as I need to, so I'm currently unfamiliar with socket implementation. I looked up a few examples and it looks pretty easy, so I'm going to ask some people about the specifics.
User avatar
asid61
Active Member
Posts: 36
Joined: Sat May 31, 2014 6:39 am
Contact:

Post by asid61 »

Is there any kind of documentation on the xscope socket interface? I cannot seem to find it anywhere. Do you know of any examples or code snippets that I could use and adapt?
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm
Contact:

Post by Folknology »

There is a Xscope socket host support library on github/xcore that makes it simpler to implement.

Not sure about any documentation

BTW there is a couple of apps that use the IP socket host in the StartKit examples

regards
Al
Post Reply