Language - Python Windows LiClipse: Difference between revisions

From Phidgets Support
(Created page with "==Use our examples== One of the best ways to start programming with Phidgets is to use our example code as a guide. Before we get started, make sure you have read #Install P...")
(No difference)

Revision as of 19:51, 5 July 2018

Use our examples

One of the best ways to start programming with Phidgets is to use our example code as a guide. Before we get started, make sure you have read how to install the Phidget Python module section above. You will also need to download LiClipse if you have not already.

Now that you have Python and the Phidget Python module installed, as well as LiClipse, select an example that will work with your Phidget:


Next, create a new Python project:

Python liclipse newproject.PNG


Add the example you just downloaded by dragging it into the project:

Python liclipse import.png

Add PhidgetHelperFunctions.py to the project by dragging it into the project.

Finally, run the project:

Python liclipse run.png


You should now have the example up and running for your device. Your next step is to look at the Editing the Examples section below for information about the example and important concepts for programming Phidgets. This would be a good time to play around with the device and experiment with some of its functionality.

Setting Up a New Project

When you are building a project from scratch, or adding Phidget functionality to an existing project, you'll need to configure your development environment to properly link the Phidget Python library.

To start, you need to create your project as shown in the previous section.

To include the Phidget Python library, add the following line to your code:

from Phidget22.PhidgetException import *
from Phidget22.Phidget import *

Then, you will also have to add a reference to your particular Phidget. For example, you would include the following line for a DigitalInput:

from Phidget22.Devices.DigitalInput import *

The project now has access to Phidgets.