Digital I/O Demo 1 -- Recording digital input from a RESPONSEPixx ================================================================================== This demo prints how many digital IOs you have access to. Since it interacts with a RESPONSEPixx, it changes five IOs to outputs. Lines 30-32 show how this is done. The value ``0x1F0000`` means that digital IOs 3 to 7 are digital outs. This comes from the binary representation of ``0x1F0000``, which is ``0b0001 1111 0000 0000 0000 0000`` (which represents IOs 0 to 23). This demo also uses **markers**. Markers are used for measuring the time seperating two specific events. As a first step, you must do your first marker, ``Datapixx('SetMarker');``, then you must decide when that marker should occur. In this example, let us use the video sync: ``Datapixx('RegWrRdVideoSync');``. You cannot get a value of the device time on that marker: ``stimulusOnsetTime = Datapixx('GetMarker');``. After this, we set up our button box: ``Datapixx('EnableDinDebounce');``, this allows us to ignore the values that oscillate when a button is pushed. ``Datapixx('SetDinLog');`` tells the device that we are going to log all the RESPONSEPixx presses. Like a schedule, you must then start the logging operation ``Datapixx('StartDinLog');``. Once the experiement is started, you can get the reactions/buttons presses and their timestamps using ``[data tt] = Datapixx('ReadDinLog');``. You can also get a response time with the difference between the timestamps and the marker. .. literalinclude:: ../DatapixxToolbox/DatapixxDemos/DatapixxDinBasicDemo.m :language: matlab :emphasize-lines: 23, 31-33, 37-39, 42-45, 71, 73 :linenos: