@@ -50,10 +50,62 @@ To run an actual experiment the Raspberry system needs the experimental files fi
...
@@ -50,10 +50,62 @@ To run an actual experiment the Raspberry system needs the experimental files fi
The next thing you want to do is to send a command to the remote host. Call [sendCommand2Host](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Network/ControlComputer/sendCommand2Host.m) for this. This function enables you to send any matlab command you like to the host via the established communication. Be aware that the commands need to be entered as strings. The function [printCmd](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Tools/printCmd.m) will do this for you. Use the output from [printCmd](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Tools/printCmd.m) as input for [sendCommand2Host](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Network/ControlComputer/sendCommand2Host.m). E.g. sendCommand2Host(_printCmd([], 'keyBuffer', 10, 'goodkey', (1:3), 'badkey', 4)_);
The next thing you want to do is to send a command to the remote host. Call [sendCommand2Host](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Network/ControlComputer/sendCommand2Host.m) for this. This function enables you to send any matlab command you like to the host via the established communication. Be aware that the commands need to be entered as strings. The function [printCmd](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Tools/printCmd.m) will do this for you. Use the output from [printCmd](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Tools/printCmd.m) as input for [sendCommand2Host](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Network/ControlComputer/sendCommand2Host.m). E.g. sendCommand2Host(_printCmd([], 'keyBuffer', 10, 'goodkey', (1:3), 'badkey', 4)_);
During the experiment your [keyBuffer](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/IO/keyBuffer.m) results will now be saved as variables on the remote host (Raspberry Pi). Do not forget to call [getKeyBufferResults](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Network/ControlComputer/getKeyBufferResult.m) on your control computer to transfer these results, otherwise you will not be able to save it. After finishing an experiment and transferring your results always call [disconnectFromHost](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Network/ControlComputer/disconnectFromHost.m)(as implied in [1.4. Function Tree](/Getting-started#function-tree)) to shut down the connection as well as the remote host. After disconnecting from a remote host we recommend to reboot the Raspberry before starting a new experiment. Call disconnectFromHost(‘reboot’) to reboot and consider to restart MATLAB or Octave on your local computer.
During the experiment your [keyBuffer](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/IO/keyBuffer.m) results will now be saved as variables on the remote host (Raspberry Pi). Do not forget to call [getKeyBufferResults](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Network/ControlComputer/getKeyBufferResult.m) on your control computer to transfer these results, otherwise you will not be able to save it. After finishing an experiment and transferring your results always call [disconnectFromHost](/Network-control-computer#disconnectfromhost)(as implied in [1.4. Function Tree](/Getting-started#function-tree)) to shut down the connection as well as the remote host. After disconnecting from a remote host we recommend to reboot the Raspberry before starting a new experiment. Call disconnectFromHost(‘reboot’) to reboot and consider to restart MATLAB or Octave on your local computer.
You can include all of the commands mentioned above in your experimental script on your control computer. When everything is set up you don’t need to do more than running this scrip to conduct an experiment.
You can include all of the commands mentioned above in your experimental script on your control computer. When everything is set up you don’t need to do more than running this scrip to conduct an experiment.
## How to flash a SD card for the OTBR Toolbox
If you want to use a Raspberry PI with the OTBR toolbox you need to copy a suitable operating system and the OTBR Toolbox including the Psychophysics toolbox to the SD card. The easiest way to do this is by using a tool “Win32DiskManager”. All you need is a valid system image for the OTBR toolbox, the disk manager and a 16GB SSD card (bigger cards are supported as well).
To start the program “Win32DiskManager” you need administrative rights, since it can also flash hard drives and other devices on your computer! Please be careful and double-check all your settings to avoid data loss!
• Select the image file for the OTBR toolbox that has to be located on your compute or an available network share. The file extension is *.img
• Make sure to select the correct drive letter! A wrong drive letter will delete the data on the selected device, even if it is an external hard drive, USB stick or SD card.
• Take your time and double check if the drive letter corresponds to the letter of the SD card!
• After checking that the drive letter is correct press the button “Write”/”Schreiben” to start the copy process from the image file to the SD card.
• Once the copy process stopped use the “Very Only” button to verify that the process was successful.
• Remove the SD card from your computer and put it in your Raspberry Pi
• After booting make sure to copy the latest version of the OTBR toolbox on the raspberry
## Updating the OTBR Toolbox and the Psychophysics Toolbox
• After booting the Raspberry PI for the first time octave starts in a window without a graphical user interface. Close this window by typing exit in Octave and open the “File Manager” (identical to the file explorer on windows).
• Browse to the folder /home/pi/Octave/Toolbox
• In this folders are two sub folders: “OTBRToolbox” and “PsychToolbox”
• To update the toolboxes simply replace one of these folders with a new version, but keep the name of the folders. **It is good practice to rename the old versions instead of deleting it!**
Doing this it is easy to go back to old versions if needed
• After copying the new files the Raspberry Pi is ready for your experiments
## Configure OTBR Toolbox and Raspberry for use in a OTBR Network setup
• If the OTBR Toolbox is used in a [network setup](/How-tos#using-a-raspberry-pi-as-local-or-remote-computer)(Raspberry Pi or computer executes code that is send via network)
• Open file: /home/pi/.octaverc by double clicking and add the command “connect2ControlComputer” at the very end of the file.
This makes sure that Octave starts and calls the function [connect2ControlComputer](/Network-remote-computer#connect2controlcomputer) after the initialization is done
• Now we have to configure the IP address of your Raspberry Pi to a new address. Therefore double click the icon changeIPAdressHere on your desktop
• Scroll down and change the line: “static ip_address=192.168.0.50/24” for the IP address 192.168.0.50 if you want to use a different IP address
• Reboot your raspberry Pi and after your Raspberry is up and running it expects command from a control computer
## Coding an MRI experiment
## Coding an MRI experiment
This toolbox comprises the option to communicate between an MRI scanner and an experimental computer. To use this option you need to connect the devices via parallel port and call the functions described below in the correct order.
This toolbox comprises the option to communicate between an MRI scanner and an experimental computer. To use this option you need to connect the devices via parallel port and call the functions described below in the correct order.