Tscope5
timer02.c
////////////////////////////////////////////////////////////////////////////////
//
// __ ______
// / /_______________ ____ ___ / ____/
// / __/ ___/ ___/ __ \/ __ \/ _ \ /___ )
// / /_(__ ) /__/ /_/ / /_/ / __/ ____/ /
// \__/____/\___/\____/ .___/\___/ /_____/
// /_/
//
// timer02.c
// - Illustration of the stimulus timing functions.
// - Compute fixation and prime time.
////////////////////////////////////////////////////////////////////////////////
#include <tscope5.h>
int main()
{
// open a display
// ts5_set_display_mode(TS5_FULLSCREEN_WINDOW);
ts5_set_vsync_mode(TS5_VSYNC_ON);
// wait a bit until the program 'settles'
ts5_wait(1.0);
// increase priority slightly
ts5_set_priority(TS5_ABOVE_NORMAL_PRIORITY);
int i;
double fix, prime, target;
for (i=0; i<5; i++) {
// draw fixation, fix=fixation onset time
ts5_printf(0.0, 0.0, "+");
// draw prime, prime=prime onset time
ts5_wait(0.495); // fixation time: 0.5 seconds.
// wait al little less than 0.5 seconds
// the flip the display (wait for vsync)
ts5_printf(0.0, 0.0, "prime");
prime = ts5_flip_display();
// draw target, target=target onset time
ts5_wait(0.045); // prime time: 0.05 seconds
ts5_printf(0.0, 0.0, "target");
target = ts5_flip_display();
// print fixation and prime time
ts5_printf(0.0, ay(-0.25), "fixation onset: %f", fix);
ts5_printf(0.0, ay(-0.35), "prime onset: %f", prime);
ts5_printf(0.0, ay(-0.45), "target onset: %f", target);
ts5_printf(0.0, ay(-0.55), "fixation time: %f", prime-fix);
ts5_printf(0.0, ay(-0.65), "prime time: %f", target-prime);
ts5_log(TS5_LOGLEVEL_0, "fixation onset: %f\n", fix);
ts5_log(TS5_LOGLEVEL_0, "prime onset: %f\n", prime);
ts5_log(TS5_LOGLEVEL_0, "target onset: %f\n", target);
ts5_log(TS5_LOGLEVEL_0, "fixation time: %f\n", prime-fix);
ts5_log(TS5_LOGLEVEL_0, "prime time: %f\n", target-prime);
// iti
ts5_wait_until(fix + 3.0);
}
// wait for a click
ts5_draw_mouse_button(ax(0.9), ay(-0.8));
return 0;
}