Getting Started with Python and Debian

Supporting 2.7 and 3.2+
User avatar
mparadis
Site Admin
Posts: 959
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Getting Started with Python and Debian

Post by mparadis »

When using the built-in functionality of a VINT port (Digital Input, Digital Output, VoltageRatioInput, or VoltageInput) you need to use setIsHubPortDevice(1), so it knows that it's opening the port itself, and not a VoltageRatioInput channel belonging to a device connected to that port. You'll still have to set HubPort, but not channel.

This video may help clear up the different cases of opening channels.
monteshaffer
Phidgetsian
Posts: 13
Joined: Mon Feb 19, 2018 1:47 am
Contact:

Re: Getting Started with Python and Debian

Post by monteshaffer »

Thanks, I watched the video before...

Code samples are more valuable:

Code: Select all

    ch = VoltageRatioInput()
    ch.setIsHubPortDevice(1)
    ch.setDeviceSerialNumber(496910)
    ch.setHubPort(2)
    ch.setChannel(0)
and

Code: Select all

ch = VoltageInput()
    ch.setIsHubPortDevice(1)
    ch.setDeviceSerialNumber(496910)
    ch.setHubPort(2)
    ch.setChannel(0)
seem to work as expected...

How can I adjust the event capture time? e.g., every 5ms, every 1000ms, and so on...
monteshaffer
Phidgetsian
Posts: 13
Joined: Mon Feb 19, 2018 1:47 am
Contact:

Re: Getting Started with Python and Debian

Post by monteshaffer »

Also, the VoltageRatio is supposed to be between 0 and 1 but appears to be in a different range:

Code: Select all

Waiting for the Phidget VoltageRatioInput Object to be attached...

Attach Event Detected (Information Below)
===========================================
Library Version: Phidget22 - Version 1.0.0 - Built Feb 26 2018 19:41:25
Serial Number: 496910
Channel: 0
Channel Class: 31
Channel Name: Voltage Ratio Input
Device ID: 98
Device Version: 100
Device Name: Hub Port - Voltage Ratio Mode
Device Class: 21


Gathering data for 15 seconds...
VoltageRatio: 0.000090
VoltageRatio: 0.000060
VoltageRatio: 0.000060
VoltageRatio: 0.000060
VoltageRatio: 0.000060
VoltageRatio: 0.000060
VoltageRatio: 0.000000
VoltageRatio: 0.000000
VoltageRatio: 0.000030
VoltageRatio: 0.000000
VoltageRatio: 0.000030
VoltageRatio: 0.000060
VoltageRatio: 0.000060
VoltageRatio: 0.000060
VoltageRatio: 0.000060
VoltageRatio: 0.000090
VoltageRatio: 0.000090
VoltageRatio: 0.000060
VoltageRatio: 0.000030
VoltageRatio: 0.000030
VoltageRatio: 0.000000
VoltageRatio: 0.000000
VoltageRatio: 0.000030
VoltageRatio: 0.000060
VoltageRatio: 0.000060
User avatar
mparadis
Site Admin
Posts: 959
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Getting Started with Python and Debian

Post by mparadis »

You can change how often data comes in using setDataInterval.

VoltageRatio is between 0 and 1; it just looks like you're measuring a very, very small voltage change on that channel. If you're expecting higher values, it's possible the wrong port has been opened, since that looks like the kind of data you'd get from a port that has nothing connected to it.
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests