expyriment.io.StreamingButtonBox

class expyriment.io.StreamingButtonBox(interface, baseline)

A class implementing a streaming button box input.

__init__(interface, baseline)

Create a streaming button box input.

Parameters:

interface : expyriment.io.SerialPort or expyriment.io.ParallelPort

the interface to use

baseline : int

code that is sent when nothing is pressed (int)

baseline

Getter for baseline.

check(codes=None, bitwise_comparison=False)

Check for response codes.

If bitwise_comparison = True, the function performs a bitwise comparison (logical and) between codes and received input.

Parameters:

codes : int or list, optional

certain bit pattern or list of bit pattern to wait for, if codes is not set (None) the function returns for any event that differs from the baseline

bitwise_comparison : bool, optional

make a bitwise comparison (default=False)

Returns:

key : int

key code or None

clear()

Clear the receive buffer (if available).

interface

Getter for interface.

logging

Getter for logging.

set_logging(onoff)

Set logging of this object on or off

Parameters:

onoff : bool

set logging on (True) or off (False)

Notes

See also design.experiment.set_log_level fur further information about event logging.

wait(codes=None, duration=None, no_clear_buffer=False, bitwise_comparison=False, callback_function=None, process_control_events=True)

Wait for responses defined as codes.

If bitwise_comparison = True, the function performs a bitwise comparison (logical and) between codes and received input and waits until a certain bit pattern is set.

Parameters:

codes : int or list, optional

bit pattern to wait for if codes is not set (None) the function returns for any event that differs from the baseline

duration : int, optional

maximal time to wait in ms

no_clear_buffer : bool, optional

do not clear the buffer (default = False)

bitwise_comparison : bool, optional

make a bitwise comparison (default = False)

callback_function : function, optional

function to repeatedly execute during waiting loop

process_control_events : bool, optional

process io.Keyboard.process_control_keys() and io.Mouse.process_quit_event() (default = True)

Returns:

key : int

key code (or None) that quited waiting

rt : int

reaction time

See also

design.experiment.register_wait_callback_function

Notes

This will also by default process control events (quit and pause). Thus, keyboard events will be cleared from the cue and cannot be received by a Keyboard().check() anymore!