// TAMS USB Switch Controller Example // A complete program to control a switch. #include #include "tamsSC.h" main () { // Declare the handle to the USB device. tHANDLE handle; // Start a session with the USB device. This call will automatically find the USB device. // If there is more than one USB device, then the ID string must be passed to uniquely // identify which USB device session to start. See example2. if (INVALID_HANDLE_VALUE == (handle = tamsSCstart (""))) { fprintf (stderr, tamsSCerror ()); exit (1); } // Set switch 4 to position B. // For example, switch 4 in this case could be an Agilent 1810, 1811, or 1812. // This call will energize one of the switch's two coils, wait until the switching operation // has completed, and then return. tamsSCswitch (handle, SWITCH_4, POSITION_B); // Optionally: with error checking. This time the switch is put to position A. if (FAIL == tamsSCswitch (handle, SWITCH_4, POSITION_A)) fprintf (stderr, tamsSCerror ()); // Shut down the USB session before exiting the program tamsSCend (handle); }