User Tools

Site Tools


guides:expconsim

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
guides:expconsim [2013/06/26 17:29]
mvdm
guides:expconsim [2018/07/07 10:19] (current)
Line 3: Line 3:
 The first version (MvdM, June 2013) is equipped with the following INPUTS: The first version (MvdM, June 2013) is equipped with the following INPUTS:
  
-  * 2 photobeams (Pololu)+  * 2 photobeams (Pololu, note that these need to be powered with a single external 3.3V power supply, plugs in to the jack next to the pushbuttons)
   * 2 pushbutton switches (to mimic e.g. a lever press)   * 2 pushbutton switches (to mimic e.g. a lever press)
  
Line 22: Line 22:
 outputSession.outputSingleScan([1 1]); outputSession.outputSingleScan([1 1]);
 </​code>​ </​code>​
 +
 +Note of course that this assumes you are in fact connecting Lines 0 and 1 on Port 0 to the "​LED"​ header on the simulator board. Also power and ground (+5V and GND) need to be connected.
 +
 +To read the state of the photobeams and push buttons, do this:
 +
 +<code matlab>
 +inputSession = daq.createSession('​ni'​);​
 +inputSession.addDigitalChannel('​Dev3',​ '​Port1/​Line0:​3',​ '​InputOnly'​);​
 +
 +%% take a sample of the status of the photobeams and switches
 +inputSession.inputSingleScan() % note for photobeams, a return value of 0 means detect; for switches, 1 means detect
 +</​code>​
 +
 +As above, this assumes that Port 1 lines 0-3 are hooked up to the photobeams and pushbutton switches.
 +
 +These basic commands can then be combined with appropriate loops and conditional statements, in accordance with your desired experimental logic, to produce a full experimental simulator. The actual running rooms are equipped with either the same NI DIO module (RR2, RR3) or something very similar (RR1, through Neuralynx instead of through NI).
guides/expconsim.1372282187.txt.gz ยท Last modified: 2018/07/07 10:19 (external edit)