Code: Select all
 /*
            * Specifies the serial number of the device to attach to.
            * For VINT devices, this is the hub serial number.
            *
            * The default is any device.
            */
            //ch.setDeviceSerialNumber(<YOUR DEVICE SERIAL NUMBER>);
            /*
            * For VINT devices, this specifies the port the VINT device must be plugged into.
            *
            * The default is any port.
            */
            //ch.setHubPort(0);
            /*
            * Specifies that the channel should only match a VINT hub port.
            * The only valid channel id is 0.
            *
            * The default is 0 (false), meaning VINT hub ports will never match
            */
             //ch.setIsHubPortDevice(true);
            /*
            * Specifies which channel to attach to.  It is important that the channel of
            * the device is the same class as the channel that is being opened.
            *
            * The default is any channel.
            */
            //ch.setChannel(0);
Code: Select all
import com.phidget22.*;
public class VoltageInputExample {
    public static void main(String[] args) throws Exception {
    	
    	double x;
    	
        VoltageInput ch = new VoltageInput();
		
        x = ch.getVoltage();
    }
}Code: Select all
VoltageRatioInput ch = new VoltageRatioInput();Code: Select all
ch.setDeviceSerialNumber(283033);
ch.setChannel(3);
Code: Select all
ch.open(5000);
Code: Select all
double x;
x = ch.getVoltage();
Code: Select all
ch.addVoltageChangeListener(new VoltageInputVoltageInputChangeListener) {
public void onVoltageChange(VoltageInputVoltageChangeEvent e) {
				System.out.printf("Voltage Changed: %.3g\n", e.getVoltage());
			}
        });
Code: Select all
import com.phidget22.*;
public class VoltageInputExample {
    public static void main(String[] args) throws Exception {
        VoltageRatioInput ch = new VoltageRatioInput();
		ch.setDeviceSerialNumber(283033);
		ch.setChannel(3);
		ch.open(5000);
		double x;
        x = ch.getVoltage();
    }
}Code: Select all
x = ch.getVoltage();Code: Select all
ch.setChannel(3);
Code: Select all
VoltageRatioInput light_ch = new VoltageRatioInput();
VoltageRatioInput temp_ch = new VoltageRatioInput();
light_ch.setChannel(3);
temp_ch.setChannel(5);