PDA

View Full Version : Anyone interested in Python-Prop communication libraries?



John Board
03-28-2012, 11:31 AM
G'day everyone,

I have been pondering the idea of developing a Python-Prop (visa versa) library. Would anyone be interested in such thing? It would kinda be like the FullDuplexSerial - except slightly easier to use, here are a few code examples:

Python:


import propcomms

propcomms.start(0) 'Starts comms on the computer port 0
while 1:
print propcomms.getDec() 'Propcomms waits for the prop to send a string, optional "no-wait" might be included


Prop:


OBJ

cc: "ComputerComms"
Ping: "Ping"

PUB Main

cc.start(31,30) '31 being the RX pin and 30 being the TX pin

repeat
cc.sendDec(Ping.Centimeters(0)) 'Assuming that a Ping((( is connected to P0
waitcnt(clkfreq/10+cnt)


I know that these code examples are pretty bad, but you get the picture. Although that might seem simplistic, I am thinking of adding in quite a few neat features, such as a running average, storage of history, etc. I just had another thought as well, possibly being able to give the prop commands, such as "STORE RAM $00 "Cat"". Which would store the string "Cat" at the ram address of $00 for example. You get the picture.

So all in all, what does everyone think? If nobody is interested, it might not be worth my while, if there is enough interest, I will probably dev it.

-John

Paul
03-28-2012, 05:49 PM
I think this would be a grand idea. I'm just learning Python but relating it to the Propeller could open up many new projects for me.

Paul

richaj45
03-29-2012, 12:24 AM
Yes, i am very much so.
I am working on a MAC with BST and it would be great to be able to have a python program to talk to a spin program that i could port between os. One of the big advantages of python.

rich

John Board
03-29-2012, 02:08 AM
VM's for the win ;)

If I get around to it, I might even consider doing the same thing with Java as well.

John Board
03-29-2012, 02:08 AM
I'll start work a bit later on. Should have a library atleast sort of functioning by the end of today.

Just had another thought. Including a way to compile and download code to the prop, using Propellant, like this:



import propcomms

propcomms.start(0)
propcomms.downloadCodeToEEPROM("C:/mySpinCode.spin")


If that didn't make sense, you'll see when the python library comes out what I mean.

John Board
03-29-2012, 07:55 AM
Decided upon a name for it - PyProp! I have been a bit busy with my new Arduino, but I have got some base code started.

prof_braino
03-29-2012, 05:54 PM
I have been pondering the idea of developing a Python-Prop (visa versa) library. Would anyone be interested in such thing? ....
So all in all, what does everyone think? If nobody is interested, it might not be worth my while, if there is enough interest, I will probably dev it.


If we get CSP channels working, I would like to inquire about Python-Prop with CSP channels. This should be the same as the regular serial interface, with a "slight" modification to include the CSP interface. Then it should talk to any prop implementation that uses CSP.

mindrobots
03-29-2012, 06:22 PM
Cool!

CSP for Python, anybody???

http://code.google.com/p/python-csp/wiki/Tutorial

Drat! Need to fork myself for another project!

John Board
03-30-2012, 11:07 PM
Been doing some work on the python side of things. I've had a bit of trouble with getting python to communicate with my demo board. The messages are getting to the demo board (I can tell from the RX LED's), but the prop doesn't seem to be recieveing them... Could this be because of some sort of "packet ending" that I'm not giving it or something? Well anyway, I will see if I can spare time to continue work on it :)

-John

max72
03-31-2012, 08:08 AM
In the past it has been posted a Python example.
I cannot find the original thread, but I probably have somewhere the python examples. In case I'll post them.
Massimo