Script won't run if elements from pyserial are called in python script

Script won't run if elements from pyserial are called in python script

k.amareen
Community Visitor Community Visitor
836 Views
1 Reply
Message 1 of 2

Script won't run if elements from pyserial are called in python script

k.amareen
Community Visitor
Community Visitor

Dear all, hope all is well.

 

I have been trying to establish in the python script serial communication via the pyserial python library with an arduino board to read data from a potentiometer. The script works fine if functions are not called from that library , but uncommenting a code line where a function from pyserial is involved will cause fusion to not even run the code.

 

Any tips on how to establish such a connection ?

0 Likes
Reply (1)
Message 2 of 2

OceanHydroAU
Collaborator
Collaborator

How about not using pyserial at all?

 

1. Write your Arduino code to output the data with "\n" 

2. Just open the file "COM1:" (or whatever number on windows) or /dev/ttys1 (or whatever number on mac) and just read in the text data from that? 

 

You can set the baud rate etc using the "mode" command on windows (or in the control panel).

Linux uses somethign like "stty -F /dev/ttyUSB1 115200" - maybe Mac does too.

 

Autodesk doesn't ship every python lib, so other things to try:

1. try including the serial library code stuff in your script folder

2. try running your code from the command line using fusions own python interpreter (this will show you the failure reason on your screen)