Phidgets
Class PhidgetMotorControl

java.lang.Object
  extended byjava.lang.Thread
      extended byPhidgets.Phidget
          extended byPhidgets.PhidgetMotorControl
All Implemented Interfaces:
java.lang.Runnable

public class PhidgetMotorControl
extends Phidget


Field Summary
 
Fields inherited from class Phidgets.Phidget
attached, deviceType, deviceVersion, events, handler, IPAddr, password, Port, serialNumber, ServerID
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
PhidgetMotorControl()
           
 
Method Summary
 void add_IPhidgetMotorControlEventsListener(_IPhidgetMotorControlEvents l)
          Sets up the event handlers
 int GetAcceleration(int Index)
          Gets a motor's acceleration from 0-100
 boolean GetInputState(int Index)
          Gets the state of a digital input
 int GetMotorSpeed(int Index)
          Gets a motor's speed
 int GetNumInputs()
          Gets the number of digital inputs
 int GetNumMotors()
          Gets the number of motors
protected  void gotData(java.lang.String[] dataArray)
           
protected  void init(java.lang.String[] dataArray)
           
 int OpenRemote(int serverSerial, int port, int serialNumber, java.lang.String pass)
          Open the device when it is on the local network.
 int OpenRemoteIP(java.lang.String ip, int port, int serialNumber, java.lang.String pass)
          Open the device when it is on a remote network.
 void remove_IPhidgetMotorControlEventsListener()
          Removes the events handlers
 void SetAcceleration(int Index, int newVal)
          Sets a motor's acceleration.
 void SetMotorSpeed(int Index, int newVal)
          Sets the motor speed.
 
Methods inherited from class Phidgets.Phidget
Close, equals, getBoolean, GetDeviceType, GetDeviceVersion, GetIsAttached, GetSerialNumber, GetServerAddress, GetServerID, GetServerPort, OpenRemote, OpenRemoteIP, run, setDeviceType, setDeviceVersion, setSerialNumber
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PhidgetMotorControl

public PhidgetMotorControl()
Method Detail

OpenRemote

public int OpenRemote(int serverSerial,
                      int port,
                      int serialNumber,
                      java.lang.String pass)
Open the device when it is on the local network. This uses a UDB broadcast to find the server with a specified serial number, so you don't need to know it's IP address, but only works on internal networks where broadcasting is allowed

Parameters:
serverSerial - Serial number of the server, or -1 for any serial
port - Server port
serialNumber - Serial number of the device or -1 for any serial
pass - Server password
Returns:
0 on success

OpenRemoteIP

public int OpenRemoteIP(java.lang.String ip,
                        int port,
                        int serialNumber,
                        java.lang.String pass)
Open the device when it is on a remote network. Use this when OpenRemote fails, such as opening Phidgets over the internet. You need to know the IP address here.

Parameters:
ip - IP address or hostname of the server
port - Server port
serialNumber - Serial number of the device or -1 for any serial
pass - Server password
Returns:
0 on success

GetNumMotors

public int GetNumMotors()
Gets the number of motors

Returns:
Motors

GetNumInputs

public int GetNumInputs()
Gets the number of digital inputs

Returns:
Inputs

GetInputState

public boolean GetInputState(int Index)
Gets the state of a digital input

Parameters:
Index - input
Returns:
State

GetAcceleration

public int GetAcceleration(int Index)
Gets a motor's acceleration from 0-100

Parameters:
Index - Motor
Returns:
Acceleration

GetMotorSpeed

public int GetMotorSpeed(int Index)
Gets a motor's speed

Parameters:
Index - Motor
Returns:
Speed from -100 to 100

SetAcceleration

public void SetAcceleration(int Index,
                            int newVal)
Sets a motor's acceleration. Valid range is from 0-100. This controls how fast the motor changes speed.

Parameters:
Index - Motor
newVal - Value

SetMotorSpeed

public void SetMotorSpeed(int Index,
                          int newVal)
Sets the motor speed. Valid range is from -100 to 100.

Parameters:
Index - Motor
newVal - Value

add_IPhidgetMotorControlEventsListener

public void add_IPhidgetMotorControlEventsListener(_IPhidgetMotorControlEvents l)
Sets up the event handlers

Parameters:
l - An object implementing the __IPhidgetMotorControlEvents interface

remove_IPhidgetMotorControlEventsListener

public void remove_IPhidgetMotorControlEventsListener()
Removes the events handlers


init

protected void init(java.lang.String[] dataArray)
Overrides:
init in class Phidget

gotData

protected void gotData(java.lang.String[] dataArray)
Overrides:
gotData in class Phidget


www.Phidgets.com

Phidgets is a trademark or registered trademark of Phidgets Inc. in the Canada and other countries.
Copyright 2005