Has somebody interfaced a Propeller to Python?
Ravenkallen
Posts: 1,057
I was just wondering if someone has done this or something similar. It doesn't need to be fancy. All i need is a way of sending data to a Python program via a usb connection with a Propeller attached to it. I searched the forums and nothing came up. Perhaps no one has thought of such a thing?
Comments
If you just need to talk rs232 then maybe py-serial would be what you need.
http://pyserial.sourceforge.net/index.html
rich
-Phil
The string you send it is pretty simple... something like "!ANG:123,123,123" where the values are Roll, Pitch and Yaw. When you look at the python code, you can see where they parse it out. It's pretty simple.
The IMU is here, but you don't need it... it's just an example: http://www.sparkfun.com/products/9623
The python client is here: http://code.google.com/p/sf9domahrs/downloads/detail?name=SF9DOF_AHRS_interface_python.zip
From a prop, you can simply send data out to it with either the Parallax Serial Terminal or FullDuplexSerial.
Bill
http://pyserial.sourceforge.net/shortintro.html
Also, here's an article interfacing Python with a BS2...
http://www.linuxjournal.com/node/7403/print
That should be enough to get you started.
I couldn't find the post that I got them from otherwise I would have just pointed you to it.
Here's Remy's original post:
http://forums.parallaxinc.com/forums/pr.aspx?f=25&m=161911
Here is another post that references one of them:
http://forums.parallax.com/showthread.php?121803-Catalyst-1.1-a-Catalina-O-S-for-the-TriBladeProp-Morpheus-DracBlade.-Hybrid-and-RamBlade&p=904386&viewfull=1#post904386
As .py are not supported as file type -- You can post it as xxxxx.py.txt.
With some info to rename on end user to xxxxx.py
import serial
ser = serial.Serial('COM4')
ser.write("Hello")
ser.close()
then i used a small Prop program to receive the serial data and display it on a OLED screen... It worked perfectly. I was so excited. I can now have huge programs running on a PC and have a Propeller send it sensor data...Thanks everybody for the help!!! I might write a small tutorial if people are interested!! Python and the Propeller are good complements for each other and they both have a weirdly similar language...
Ron
Considering it allows Python scripts run in it, you could create a type of Propeller game-controller for it or something. Worth musing about.
Python is almost exactly like spin, same assignment operators, same object assignment, etc.
Lev