ButtonBoxes

From TSG Doc
Revision as of 10:21, 12 March 2014 by Wiki-admin (talk | contribs)

Jump to: navigation, search

General

Hardware

Revisions

Revision 1

Revision 2

Revision 3

Revision 4

Presentation Settings

File:Buttonbox1.png

Psychopy Settings

  1. !/usr/bin/env python

from psychopy import core, visual, event from rusocsci import buttonbox import logging, time

    1. Setup Section
  1. logging.getLogger().setLevel(logging.DEBUG) # use this for debug info

win = visual.Window([400,300], monitor="testMonitor") bb = buttonbox.Buttonbox()

    1. Experiment Section

b = bb.waitButtons(maxWait = 10.0, buttonList=['A']) print("b: {}".format(b))

    1. Cleanup Section

core.quit() The following script lights the LEDs under the buttons pressed.

  1. !/usr/bin/env python
  2. from __future__ import print_function

import logging, time, sys from rusocsci import buttonbox

    1. Setup Section

led = [False]*8

    1. Experiment Section

bb = 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
           elif ord(c) >= ord('A') and ord(c) < 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

Inquisit Settings

Matlab Settings

E-Prime