WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-14-2007, 01:14 PM
Jerry Jerry is offline
Member
 
Join Date: Jun 2004
Posts: 105
labjack plugin

Could you please give me all the commands that can be sent to
the LabJack.dls which comes with Viz 3?
Reply With Quote
  #2  
Old 03-14-2007, 04:36 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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);
}
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:15 PM.


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