Class ServoTest

java.lang.Object
  |
  +--ServoTest

public class ServoTest
extends java.lang.Object
SevroTest is a sample application that allows you to rotate a servo clockwise then counter-clockwise using the Mini SSC (tm) II Serial Servo Controller from Scott Edwards Electronics, Inc.
 
Installation:
Make sure you have the Java (tm) Communications API installed. You can find the communications API at http://java.sun.com/products/javacomm/ Make sure you have Java(tm) installed and working properly. I was using Java 2 but as long as the communications API supports your version of Java you should be okay. Compile this sample code using your Java compiler.

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;)

Author:
Thomas Hubbard (jack-7@rcn.com)

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

ServoTest

public ServoTest()
Method Detail

closePort

public void closePort()
Close the port that is attached to the servo controller.
Returns:
none

initPort

public void initPort(int baud)
              throws javax.comm.UnsupportedCommOperationException
Intialize the port that is attached to the servo controller.
Parameters:
baud - the baud rate the servo controller is set for (see the servo controller installation instructions)
Returns:
none
Throws:
javax.comm.UnsupportedCommOperationException - if the serial port does not setting baud, data, stop or parity.

main

public static void main(java.lang.String[] args)

openPort

public void openPort(java.lang.String portName)
              throws javax.comm.NoSuchPortException,
                     javax.comm.PortInUseException
Open the port that is attached to the servo controller.
Parameters:
portName - The name of the port to open e.g. COM1
Returns:
none
Throws:
javax.comm.NoSuchPortException - when a port requested is not present in the system.
javax.comm.PortInUseException - when the port requested has been opened by another application.

usage

public void usage()
Show the proper usage.