WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   labjack plugin (https://forum.worldviz.com/showthread.php?t=1022)

Jerry 03-14-2007 01:14 PM

labjack plugin
 
Could you please give me all the commands that can be sent to
the LabJack.dls which comes with Viz 3?

farshizzo 03-14-2007 04:36 PM

The plugin has not changed since it was originally written for VRUT. Here is the code for the CommandSensor function of the LabJack:
Code:

void CommandSensor(void *sensor)
{
        long idnum=-1;
        long demo=0;
        long numCh=4;
        static int tog = 1;
        long trisD = 3;
        long trisIO = 0;
        long stateD1=1;
        long stateD2 = 2;
        long state;
        long stateIO = 0;
        long updateDigital = 1;
        long outputD[3];
        long result;
        long overVoltage;
        float voltage;

        SetThreadPriority(GetCurrentThread,THREAD_PRIORITY_TIME_CRITICAL);               
       
        switch( (int) ((VRUTSensorObj *)sensor)->command) {
        case 0:                                                // Both eyes closed                       
                state = 0;
                DigitalIO(&idnum, demo,&trisD,trisIO, &state, &stateIO, updateDigital, outputD);
                break;
        case 1:                                                // Left closed, right open
                state = 1;
                DigitalIO(&idnum, demo,&trisD,trisIO, &state, &stateIO, updateDigital, outputD);
                break;
        case 10:                                                // Left open, right closed
                state = 2;
                DigitalIO(&idnum, demo,&trisD,trisIO, &state, &stateIO, updateDigital, outputD);
                break;
        case 11:                                                // Both open
                state = 3;
                DigitalIO(&idnum, demo,&trisD,trisIO, &state, &stateIO, updateDigital, outputD);
                break;
        case 2:
                fprintf(stdout,"%.2f %.2f\n",((VRUTSensorObj *)sensor)->data[0],((VRUTSensorObj *)sensor)->data[1]);
                result = EAnalogOut(&idnum,demo,((VRUTSensorObj *)sensor)->data[0],((VRUTSensorObj *)sensor)->data[1]);
                fprintf(stdout,"result = %d, idnum = %d\n",result,idnum);
                break;
        case 3:
                EAnalogIn(&idnum,demo,0,0,&overVoltage,&voltage);
                fprintf(stdout,"voltage = %.2f\n",voltage);
                break;
        }
        SetThreadPriority(GetCurrentThread,THREAD_PRIORITY_NORMAL);
}



All times are GMT -7. The time now is 03:37 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2022, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC