Passing array to Python Script

Technical discussions around xCORE processors (e.g. General Purpose (L/G), xCORE-USB, xCORE-Analog, xCORE-XA).
User avatar
asid61
Active Member
Posts: 36
Joined: Sat May 31, 2014 6:39 am

Passing array to Python Script

Postby asid61 » Sat Jul 26, 2014 9:15 pm

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

Postby Bianco » Sat Jul 26, 2014 9:44 pm

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

Postby asid61 » Sun Jul 27, 2014 12:15 am

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

Postby Bianco » Sun Jul 27, 2014 12:36 am

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

Postby asid61 » Sun Jul 27, 2014 4:38 am

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

Postby asid61 » Sat Aug 02, 2014 8:37 am

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

Postby Folknology » Sat Aug 02, 2014 12:40 pm

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

Who is online

Users browsing this forum: No registered users and 5 guests