Skip to Navigation

Reply to comment

#1

Python support for the U12 is provided in LabJackPython, so you will want to go to that page for installation instructions.  There is a quickstart on that page for the U3, but calls are not the same on the U12 beyond the similarity of importing the module, creating a class instance and using the methods provided by classes.  At the moment there is no Python tutorial for the U12, but there are more examples in the Low-Level Function Reference section of the User's Guide.  I updated this page to provide a link to that.

I will do a quick explanation of the example code on this page below with comments.

 

import U12 #Importing the U12 module

d = u12.U12() #Creating a new class instance of the U12 class named d.  The constructor opens the  U12.

d.eAnalogIn(0) #The newly created instance d provides methods to send/receive U12 data.  The eAnalogIn method reads an AI voltage.  In this case AI0.

 

It would be a good idea to do some Python language reading to better understand what is going on in our examples.  In particular learn about classes and methods, as our U12 Python interface uses it.  U12 class and method documentation can be found in the source code.  For reading one analog input, use the eAnalogIn U12 class method.  To read multiple analog inputs at once, use the aiSample (Windows only) or rawAISample (Linux/Mac only) method.  For setting analog outputs use the eAnalogOut method.

If you have further questions in regards to programming, the better location to post your questions is on our forum.

Reply

Totally secret. Used only if you want to be notified of new comments.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <p> <br>
  • Lines and paragraphs break automatically.

More information about formatting options