Josh wrote[quote='Josh' pid='399' dateline='1514525705']
Hi Sebastian
I haven't tried a VR application and Bpod on the same computer. Since you have multiple cores, the OS will most likely run most processes in each matlab instance on a separate processor. In Windows 7 (and possibly others), you can set the core affinity of each MATLAB instance manually if necessary.
The two MATLAB instances can exchange data (i.e. the next trial's visual parameters, the previous trial's position data) using TCP/IP on a local port. If you have Instrument Control Toolbox, your starting point is here. Otherwise, it's possible with PsychToolbox's fork of PNET.
If you're using the rotary encoder module, the VR MATLAB instance can retrieve the current position via USB to render the environment using the currentPosition() method. A direct CAT5e line from the encoder module to the state machine, can transfer position threshold crossing events at lower latency than via the computer.
I hope this helps!
-Josh
Thanks for your reply Josh!
Let me ask you something else. I already have a rotary encoder from US Digital that I plan to use, and I have an Arduino code to read the signal in an Arduino Uno that is working fine. The next task is to send this data to Matlab. For that, I thought I could use your ArCOM interface. But I am having an issue when trying to run the example code that you provide in the ArCOM site. It seems that the ArCOM setup instructions are not up to date with the current ArCOM github folder organization. Thus, I copied to the Arduino Libraries folder the files ArCOM.h and ArCOM.cpp from the ArCOM/Arduino/src/ folder found in the github repository.
I then tried to run in my Arduino Uno the following example code found in your site:
Arduino code:
#include "ArCOM.h" // Import the ArCOM library
ArCOM myUSB(SerialUSB); // Create an ArCOM wrapper for the SerialUSB interface
unsigned short myDataArray[10] = {0}; // Create a 1x10 uint16 array
void setup() {
SerialUSB.begin(115200); // Initialize the USB serial port
myUSB.writeUint16Array(myDataArray,10); // Send the array to MATLAB's buffer
}
void loop() {}
But I get the following error:
Arduino:1.8.2 (Windows 7), Tarjeta:"Arduino/Genuino Uno"
test:2: error: 'SerialUSB' was not declared in this scope
ArCOM myUSB(SerialUSB); // Create an ArCOM wrapper for the SerialUSB interface
^
C:\Users\Usuario\Documents\Arduino\test\test.ino: In function 'void setup()':
test:5: error: 'SerialUSB' was not declared in this scope
SerialUSB.begin(115200); // Initialize the USB serial port
^
exit status 1
'SerialUSB' was not declared in this scope
Do you know what is the problem?
I am aware that this is not related to the Bpod, so I am sorry for taking your time, but maybe you can guide me on this.
Thanks again.
Sebastian.