java.lang.Object | +--ServoTest
Next, connect the servo controller and servos to your PC according to the installation instructions from the servo controller manufacturer.
Note: This sample is setup to exercise servo 0 at 9600 baud. If this is not what you need, change the sample code as noted in the source. If you are running under Windows, make sure the port settings are set properly in Control Panel.
Now run the sample. From the installation directory:
java ServoTest [com port]
example: java ServoTest com1
That should move the servo clockwise then counter-clockwise. The sample is meant to be illustrative only. It would be quite easy, using this sample, to create a Java application that captured input from the keyboard to control the servos to make a simple remote control. That is left as an exercise for the reader;)
| Constructor Summary | |
| ServoTest() | |
| Method Summary | |
| void | closePort()
Close the port that is attached to the servo controller. |
| void | initPort(int
baud)
Intialize the port that is attached to the servo controller. |
| static void | main(java.lang.String[] args) |
| void | openPort(java.lang.String
portName)
Open the port that is attached to the servo controller. |
| void | usage()
Show the proper usage. |
| Methods inherited from class java.lang.Object |
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ServoTest()
| Method Detail |
public void closePort()
public void initPort(int baud) throws javax.comm.UnsupportedCommOperationException
public static void main(java.lang.String[] args)
public void openPort(java.lang.String portName) throws javax.comm.NoSuchPortException, javax.comm.PortInUseException
public void usage()