psychopy.org | Reference | Downloads | Github

'blockDuration' corsi

I am using an existing corsi grid task from Pavlovia. Currently, each block in a sequence from my excel sheet becomes red for .5 seconds, then it returns back to white. I want there to be a 1 second delay before the next block in the sequence becomes red. In other words, I want a block to turn red for .5 seconds, turn white for 1 second, and then the next block will turn red for .5 seconds and so on.

The Begin Routine tab looks like this:

# initial state
blkIndex = 0
nextSwitch = blockDuration
end = False
currBlock = None

# store blocks as a dictionary (to switch between name/object)
blocks = {}
blocks['blk1']=blk1
blocks['blk2']=blk2
blocks['blk3']=blk3
blocks['blk4']=blk4
blocks['blk5']=blk5
blocks['blk6']=blk6
blocks['blk7']=blk7
blocks['blk8']=blk8
blocks['blk9']=blk9
blocks['blk10']=blk10

for blockName in blocks:
    blocks[blockName].color="white"

Each Frame:

    if currBlock is not None:
        #reset color of current block
        currBlock.color = 'white'

    # then change current block and make that red
    if blkIndex >= len(sequence):
        end = True  # no more blocks to show
    else:
        currBlockName = sequence[blkIndex]
        currBlock = blocks[currBlockName]
        currBlock.color = 'red'

        # track time of this change
        nextSwitch += blockDuration
    blkIndex += 1

I am very new to coding so anything will be very much appreciated!