Shop OBEX P1 Docs P2 Docs Learn Events
Anyone interested in Python-Prop communication libraries? — Parallax Forums

Anyone interested in Python-Prop communication libraries?

John BoardJohn Board Posts: 371
edited 2012-03-31 00:08 in Propeller 1
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

Comments

  • PaulPaul Posts: 263
    edited 2012-03-28 09:49
    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
  • richaj45richaj45 Posts: 179
    edited 2012-03-28 16:24
    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 BoardJohn Board Posts: 371
    edited 2012-03-28 18:08
    VM's for the win ;)

    If I get around to it, I might even consider doing the same thing with Java as well.
  • John BoardJohn Board Posts: 371
    edited 2012-03-28 18:08
    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 BoardJohn Board Posts: 371
    edited 2012-03-28 23:55
    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_brainoprof_braino Posts: 4,313
    edited 2012-03-29 09:54
    John Board wrote: »
    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.
  • mindrobotsmindrobots Posts: 6,506
    edited 2012-03-29 10:22
    Cool!

    CSP for Python, anybody???

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

    Drat! Need to fork myself for another project!
  • John BoardJohn Board Posts: 371
    edited 2012-03-30 15:07
    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
  • max72max72 Posts: 1,155
    edited 2012-03-31 00:08
    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
Sign In or Register to comment.