How to use the psychtoolbox.hid.devices function in psychtoolbox

To help you get started, we’ve selected a few psychtoolbox examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kleinerm / Psychtoolbox-3 / PsychPython / demos / hidtest_pythonic.py View on Github external
# hidtest.py - Basic test of PsychHID for Python
# Also tests WaitSecs, as it is utilized here.
#
# The test will be subject to change without notice, it is throwaway wip code.
#
# (c) 2019 Jon Peirce - Licensed under MIT license.
# (c) 2018 Mario Kleiner - Licensed under MIT license.

from psychtoolbox import hid
import psychtoolbox as ptb

print("Devices:")
for dev in hid.devices():
    print("  %(index)s: %(product)s "
          "usagePageValue=%(usagePageValue)s, usageValue=%(usageValue)s"
          % dev)

print("Keyboards:")
kbIDs, kbNames, kbDevices = hid.get_keyboard_indices()
for dev in kbDevices:
    print("  %(index)s: %(product)s" % dev)

def run():

    dev = kbDevices[0]
    # KbQueueTest
    ptb.WaitSecs('YieldSecs', 1)
    keyboard = hid.Keyboard(dev['index'])