

exitButton = 'white' finished = False while finished = False : #read device status DPxUpdateRegCache () #check log status and see if there are new log frames since previous read DPxGetDinStatus ( logStatus ) newData = logStatus #if new log entries if newData > 0 : #read all new events in log. #If our designated exit button is pressed, we stop logging. #Any time a button press or release is logged, we print the timestamp and details. logStatus = DPxSetDinLog ( 0, 1000 ) #Let's also enable debounce to avoid noise DP圎nableDinDebounce () #This is our start command, but it won't take effect until it is passed to the device register DPxStartDinLog () #Let's push these commands to the device register, and record the time this occurred DPxUpdateRegCache () startTime = DPxGetTime () #Let's create a loop which checks the log for button presses every 0.25 seconds. #This means it will give us both button press and button release times. If two buttons are pressed at the same time this will generate a unique code, which we will ignore buttonCodes = #Let's enable a digital input log on our device, at buffer address 12e6, with size 1000 #This log ONLY marks rising and falling voltages on the digital input, and when they occur. You can check what your own button codes are using the PyPixx Digital I/O demo #Note 2: these codes are for single button presses only. close ()įrom pypixxlib.datapixx import DATAPixx3 from psychopy import core #connect to VPixx device device = DATAPixx3 () #First, let's make a dictionary of codes that correspond to our buttons. updateRegisterCache () # Close the devices my_device. startScheduleLeft () my_device_controller. # The forth parameter is a schedule counter, indicating the number of ticks # that the schedule should run before stopping. # The second and third parameters indicate that the audio samples will be played at 40 kHz. # We must at this point create the audio schedule # The first parameter is the schedule onset, which we set to 0, # meaning that the first schedule tick will occur immediately once the schedule starts. updateRegisterCache () # Send everything to the device. writeRam ( 0, audio_stim ) # Write the audio stimulus in the ram. audio_stim = import math for i in range ( 32 ): audio_stim. # This is done by simply filling a list with a sound wave. setAudioBuffer ( 0, 64 ) # Set the audio to start at address 0, and size 64. setLeftRightMode ( 'mono' ) # Set which mode the audio will be output. initializeCodec () # Configures initial CODEC state. # The audio is done on the controller, so the next functions use the controller object. setCustomStartupConfig () # The projector will remember this configuration.

PSYCHOPY DEMOS UPDATE
updateRegisterCache () # Update the new modes to the device. setVesaFreeRun ( True ) # Sets the VESA port to work with the polariser. setCeilingMountMode ( True ) # Sets the projector to ceiling-mount mode. setRearProjectionMode ( True ) # Sets the projector to read-projection mode. From pypixxlib.propixx import PROPixx, PROPixxCTRL from pypixxlib._libdpx import DPxSelectDevice my_device = PROPixx () my_device_controller = PROPixxCTRL () my_device.
