This example makes use of the function [keyBuffer](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/IO/keyBuffer.m), which is used for animal experiments mostly. Because you have no hardware like response keys or IO devices installed you can use the keyboard to test your experiments. The keyboard as response device is defined in [myHardwareSetup.m](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/myHardwareSetup.m) in section 2 by default. If you would like to use an IO hardware device that is supported by our toolbox all you have to do is change the setting in section 2 and make sure the response keys is connected to pin 1 (or input 1).
This example makes use of the function [keyBuffer](/User-or-animal-response#keybuffer-animal), which is used for animal experiments mostly. Because you have no hardware like response keys or IO devices installed you can use the keyboard to test your experiments. The keyboard as response device is defined in [myHardwareSetup.m](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/myHardwareSetup.m) in section 2 by default. If you would like to use an IO hardware device that is supported by our toolbox all you have to do is change the setting in section 2 and make sure the response keys is connected to pin 1 (or input 1).
The third example shows a similar experiment using the function [getAnswer](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/IO/getAnswer.m), which is mostly used in human experiments. In this example the program asks the user to press a key and presents the pressed key on the screen.
The third example shows a similar experiment using the function [getAnswer](/User-or-animal-response#getanswer-human), which is mostly used in human experiments. In this example the program asks the user to press a key and presents the pressed key on the screen.
All examples use two computer monitors. If you want to run it on only one monitor, you have to delete the ‘(2)’ behind [initWindow](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Screen/initWindow.m). We recommend using two computer screens if possible. This allows to program in MATLAB or Octave on one screen and see the results on the second screen.
Depending on your device initWindow and [closeWindow](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Screen/closeWindow.m) may need some time to run. This means in an actual experiment when exact timing matters call the window initialization before the actual start of the experiment.
All examples use two computer monitors. If you want to run it on only one monitor, you have to delete the ‘(2)’ behind [initWindow](/Stimuli-Display#initwindow). We recommend using two computer screens if possible. This allows to program in MATLAB or Octave on one screen and see the results on the second screen.
Depending on your device [initWindow](/Stimuli-Display#initwindow) and [closeWindow](/Stimuli-Display#closewindow) may need some time to run. This means in an actual experiment when exact timing matters call the window initialization before the actual start of the experiment.
## Function tree
The functions of this toolbox are organized hierarchically. Some functions need to be called before you can use others. The following list displays this dependency. The keywords on the right in the oval-shaped bubbles mark functions that belong together. They can be used to find the respective headers in this documentation. On the left, mostly in boxes, you can see the functions of this toolbox as a flow chart. When writing a script make sure to follow the arrows of the chart. When you open a branch by calling the initialization function for a group of functions (e.g. initVideo for video display) make sure to follow this path until the end and call a close function if needed (e.g. [closeVideo](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Video/closeVideo.m)). Close functions can be identified by an arrow pointing downwards. If a function group does not have a close function (e.g. [Text options](Text Options)) then there is nothing specific to call when you want to exit this group. Every function mentioned will also be explained below in this documentation.
At the very beginning of every script you always have to call the [initOTBR](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/initOTBR.m) function to initialize the use of the OTBR Toolbox. At the end of scripts you always have to call stopExperiment. The [myHardwareSetup](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/myHardwareSetup.m) and [myParadigmSetup](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/myParadigmSetup.m) functions will be called internally. If you want to use visual stimuli (Text, Images, Videos) you always need to call [initWindow](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Screen/initWindow.m) before, to initialize a presentation window. After finishing visual output call [closeWindow](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Video/closeVideo.m) to shut down the presentation window again. If you want to use network communication that is more flexible than the options mentioned in Device Interface please read [section 2.2. Coding device interfaces](/How-tos#using-a-raspberry-pi-as-local) for further information) first.
The functions of this toolbox are organized hierarchically. Some functions need to be called before you can use others. The following list displays this dependency. The keywords on the right in the oval-shaped bubbles mark functions that belong together. They can be used to find the respective headers in this documentation. On the left, mostly in boxes, you can see the functions of this toolbox as a flow chart. When writing a script make sure to follow the arrows of the chart. When you open a branch by calling the initialization function for a group of functions (e.g. initVideo for video display) make sure to follow this path until the end and call a close function if needed (e.g. [closeVideo](/Video-display#closevideo)). Close functions can be identified by an arrow pointing downwards. If a function group does not have a close function (e.g. [Text options](Text Options)) then there is nothing specific to call when you want to exit this group. Every function mentioned will also be explained below in this documentation.
At the very beginning of every script you always have to call the [initOTBR](/Initialization#initotbr) function to initialize the use of the OTBR Toolbox. At the end of scripts you always have to call stopExperiment. The [myHardwareSetup](/Initialization#myhardwaresetup) and [myParadigmSetup](/Initialization#myparadigmsetup) functions will be called internally. If you want to use visual stimuli (Text, Images, Videos) you always need to call [initWindow](/Stimuli-Display#initwindow) before, to initialize a presentation window. After finishing visual output call [closeWindow](/Stimuli-Display#closewindow) to shut down the presentation window again. If you want to use network communication that is more flexible than the options mentioned in Device Interface please read [section 2.2. Coding device interfaces](/How-tos#using-a-raspberry-pi-as-local) for further information) first.