Changes

Jump to navigation Jump to search
506 bytes added ,  11:25, 2 February 2016
no edit summary
Line 229: Line 229:  
# print the button pressed
 
# print the button pressed
 
print("b: {}".format(b))  
 
print("b: {}".format(b))  
 +
</syntaxhighlight>
 +
 +
'''Example using markers with the buttonbox in Python:'''
 +
 +
<syntaxhighlight lang="python" line>
 +
#!/usr/bin/env python
 +
 +
# import the rusocsci.buttonbox module
 +
from rusocsci import buttonbox
 +
 +
# make a buttonbox
 +
bb = buttonbox.Buttonbox()
 +
 +
# send a marker
 +
bb.sendMarker(val=100)    #This is your marker code, range code 1-255
 
</syntaxhighlight>
 
</syntaxhighlight>
   Line 250: Line 265:  
</syntaxhighlight>
 
</syntaxhighlight>
   −
'''Example using markers with the buttonbox in Python:'''
+
'''Example using BITSI extended analog read in Python:'''
    
<syntaxhighlight lang="python" line>
 
<syntaxhighlight lang="python" line>
Line 259: Line 274:     
# make a buttonbox
 
# make a buttonbox
bb = buttonbox.Buttonbox()
+
ser = serial.Serial("COM2", 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()
   −
# send a marker
+
key = event.getKeys()
bb.sendMarker(val=100)    #This is your marker code, range code 1-255
+
try:
 +
if key[0]=='escape':
 +
break
 +
except:
 +
continue
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Navigation menu