Changes

ButtonBoxes

476 bytes added, 09:21, 12 March 2014
no edit summary
== Psychopy Settings ==
{|| <code>#!/usr/bin/env python</code>|-| <code>from psychopy import core, visual, event</code>|-| <code>from rusocsci import buttonbox</code>|-| <code>import logging, time</code>|- | <code>## Setup Section</code>|-| <code>#logging.getLogger().setLevel(logging.DEBUG) # use this for debug info</code>|-| <code>win = visual.Window([400,300], monitor="testMonitor")</code>|-| <code>bb = buttonbox.Buttonbox()</code>|- | <code>## Experiment Section</code>|-| <code>b = bb.waitButtons(maxWait = 10.0, buttonList=['A'])</code>|-| <code>print("b: {}".format(b))</code>|- | <code>## Cleanup Section<core.quit()The following script lights the LEDs under the buttons pressed. #!/usr/bin/codeenv python#from __future__ import print_functionimport logging, time, sysfrom rusocsci import buttonbox ## Setup Sectionled = [False]*8 ## Experiment Sectionbb = buttonbox.Buttonbox()while True: buttons = bb.getButtons() if len(buttons): for c in buttons: if ord(c) >= ord('a') and ord(c) < ord('a')+8:| led[ord(c) -ord('a')] = False| <code elif ord(c) >core.quit= ord('A') and ord(c)</code>ord('A')+8:| led[ord(c) -ord('A')] = True| bb.setLeds(led) #print("buttons ({:3d}): {}{}".format(len(buttons), buttons, " "*50), end="\r") #sys.stdout.flush()
== Matlab Settings ==