Skip to content
Permalink
Browse files

Merge pull request #6 from chrplr/master

added a short script to test the touchscreen
  • Loading branch information
fladd committed Nov 28, 2019
2 parents ae9df06 + 0878e1c commit 4e8491de7a454a703520e65fe89cc8accad7cef2
Showing with 36 additions and 0 deletions.
  1. BIN examples/no2.jpg
  2. +36 −0 examples/touchscreen-test.py
  3. BIN examples/yes2.jpg
BIN +4.65 KB examples/no2.jpg
Binary file not shown.
@@ -0,0 +1,36 @@
#! /usr/bin/env python
# Time-stamp: <2019-11-19 13:02:26 christophe@pallier.org>

""" Touchscreen test """

import expyriment

NTRIALS = 5

exp = expyriment.design.Experiment(name="sentence picture matching task") # create an Experiment object
expyriment.control.set_develop_mode(on=True) ## Set develop mode. Comment for real experiment

expyriment.control.initialize(exp)

img1 = expyriment.stimuli.Picture("no2.jpg", position=(-200, 100)) # NO
img2 = expyriment.stimuli.Picture("yes2.jpg", position=(200, 100)) # YES

BB = expyriment.io.TouchScreenButtonBox([img1, img2])
BB.create()

exp.add_data_variable_names(['resonse', 'rt'])

expyriment.control.start()

for i in range(NTRIALS):
BB.show()
img, resptime = BB.wait()

exp.data.add(["No" if img == img1 else "Yes" , resptime])

exp.screen.clear()
exp.screen.update()

exp.clock.wait(2000)

expyriment.control.end()
BIN +10.8 KB examples/yes2.jpg
Binary file not shown.

0 comments on commit 4e8491d

Please sign in to comment.
You can’t perform that action at this time.