[Beginner] FreePIE pySerial Trouble

Official forum for open source FreePIE discussion and development.
Post Reply
TheGorramBatguy
One Eyed Hopeful
Posts: 3
Joined: Tue May 05, 2015 4:03 am

[Beginner] FreePIE pySerial Trouble

Post by TheGorramBatguy »

My project is to integrate foot pedals (via an Arduino) with a controller to "walk" in games like Skyrim. I've just discovered FreePIE and am toying with Python for the first time.

Currently, I have succeeded in installing pySerial to read output from the Arduino, and I have successfully run a simple script I found to print the serial monitor contents - in my Python editor.

When I paste the same exact script into FreePIE, I get the "No module named serial" error as though I had not succeeded in installing the pySerial module.

Clearly there is something I need to do to make FreePIE recognize this module. What am I missing?

Thank you for any help the FreePIE community is willing and able to give.

Also, I'm using Python 2.7 and pySerial 2.7.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: [Beginner] FreePIE pySerial Trouble

Post by CyberVillain »

Hi and welcome

You need to copy pySerial to the FreePIE\pylib folder

You can also use the .NET serial com class

https://msdn.microsoft.com/en-us/librar ... 10%29.aspx

Like

Code: Select all

from System.IO.Ports import SerialPort 

def onData(s, e):
	global port
	data =  port.ReadExisting();

if starting:
	port = SerialPort("COM2", 115200)	
	port.DataReceived += onData
	port.Open()
TheGorramBatguy
One Eyed Hopeful
Posts: 3
Joined: Tue May 05, 2015 4:03 am

Re: [Beginner] FreePIE pySerial Trouble

Post by TheGorramBatguy »

Sorry for the long delay in responding - I generally have little time for my projects.

I assume by "copy pySerial to the FreePIE\pylib" that I need to install pySerial in the pylib directory exactly in parallel to how I installed it in the Lib directory under Python. I have attempted this multiple times, but freePIE still does not recognize the Serial module.

As for the .net option, the code runs without trouble, but I don't see any of the serial content displayed in the Console tab. So, if it's working, I can't see it.

Please provide some idiot-proof instructions, if you'd be so kind.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: [Beginner] FreePIE pySerial Trouble

Post by CyberVillain »

That code does nothing with the input, you could try displaying it in the watch window?

Code: Select all

from System.IO.Ports import SerialPort 

def onData(s, e):
   global port
   data =  port.ReadExisting();
   diagnostics.watch(data)

if starting:
   port = SerialPort("COM2", 115200)   
   port.DataReceived += onData
   port.Open()
Post Reply

Return to “FreePIE”