Changes

Jump to navigation Jump to search
1,026 bytes removed ,  11:00, 16 November 2022
Line 141: Line 141:  
</syntaxhighlight>
 
</syntaxhighlight>
   −
'''Example using BITSI extended in Python:'''
+
<br/>'''Example using the Vertical Sync sensor in PsychoPy:'''
 
  −
<syntaxhighlight lang="python" line>
  −
#!/usr/bin/env python
  −
 
  −
# import the rusocsci.buttonbox module
  −
from rusocsci import buttonbox
  −
 
  −
# make a buttonbox
  −
bb = buttonbox.Buttonbox()
  −
 
  −
# select a function
  −
bb.sendMarker(val=(ord(X)))    #select pulse time
  −
bb.sendMarker(val=2)          #set time of dureation pulse to 2ms
  −
 
  −
bb.sendMarker(val=(ord(M)))    #select marker out
  −
bb.sendMarker(val=115)          #set marker value 115
  −
</syntaxhighlight>
  −
 
  −
'''Example using BITSI extended analog read in Python:'''
  −
 
  −
<syntaxhighlight lang="python" line>
  −
#!/usr/bin/env python
  −
 
  −
# import the rusocsci.buttonbox module
  −
import serial
  −
 
  −
# make a buttonbox
  −
ser = serial.Serial("COM2", 115200, timeout = 0.10 )
  −
ser = serial.Serial("/dev/ttyUSB0", 115200, timeout = 0.10 )
  −
 
  −
while True:
  −
ser.write('A1')
  −
ser.flush()
  −
x = ser.readline()
  −
visual.TextStim(win, text=x).draw()
  −
 
  −
# black screen for 1000 ms
  −
win.flip()
  −
 
  −
key = event.getKeys()
  −
try:
  −
if key[0]=='escape':
  −
break
  −
except:
  −
continue
  −
</syntaxhighlight>
  −
 
  −
<br/>'''Example using the Buttonbox in PsychoPy:'''
      
<syntaxhighlight lang="python" line>
 
<syntaxhighlight lang="python" line>
Line 222: Line 174:  
<br>
 
<br>
 
<br>
 
<br>
 +
 
=== Matlab ===
 
=== Matlab ===
 
'''Example using markers with the Buttonbox in Matlab:'''
 
'''Example using markers with the Buttonbox in Matlab:'''

Navigation menu