Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

1 REPLY 1
Reply
Message 1 of 2
k.amareen
395 Views, 1 Reply

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

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 ?

1 REPLY 1
Message 2 of 2
OceanHydroAU
in reply to: k.amareen

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)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report