WorldViz User Forum

WorldViz User Forum (
-   Vizard (
-   -   Cedrus Response Pad in Vizard (

Roy 10-30-2021 04:59 AM

Cedrus Response Pad in Vizard
What's the differences between vizcedurus and vizxid modules in Vizard 7?

There are already some posts about Cedrus response pad, but a bit confusing how to use it as a response device in Vizard.
For example, what' the easy or suitable way to use the Cedrus pad as a response device like a general keyboard to get the response time and pressed key?

Jeff 11-09-2021 09:26 PM

I think vizxid is the more recent of the two modules. The following code has worked for other users with a Cedrus response pad. Does this work for you?


import viz
import viztask


#Connect to xid device
import vizxid #Default: port=1 , baudRate=115200

def TestReactionTime():
        #Add instruction label
        label = viz.addText('Press the spacebar to start the experiment\nWhen the red square turns green, press button 3 on the cedrus pad',viz.ORTHO)
        #Start expirement when spacebar is pressed
        yield viztask.waitKeyDown(' ')

        #Remove the label
        #Add quad to screen
        quad = viz.addTexQuad(viz.SCREEN)
        #Data for getting values from wait conditions
        d = viz.Data()
        while True:
                #Set quad to red color
                #Wait random amount of time
                yield viztask.waitTime( vizmat.GetRandom(1.5,2.5) )
                #Set quad color to green
                #Wait for next frame to be drawn to screen
                yield vizxid.waitDraw()
                #Wait for button 3 on XID to be pressed
                yield vizxid.waitButtonDown(3,d)
                #Calculate reaction time
                reactionTime = d.time
                print('Reaction time:',reactionTime)

viztask.schedule( TestReactionTime() )

All times are GMT -7. The time now is 09:53 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2022, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC