Tscope5
cedrusbox02.c
////////////////////////////////////////////////////////////////////////////////
//
// __ ______
// / /_______________ ____ ___ / ____/
// / __/ ___/ ___/ __ \/ __ \/ _ \ /___ )
// / /_(__ ) /__/ /_/ / /_/ / __/ ____/ /
// \__/____/\___/\____/ .___/\___/ /_____/
// /_/
//
// cedrusbox02.c
// - Use the cedrusbox for trigger input.
// - This example can be used
/// - with trigger simulation
/// - with a RBX or LUMINA response box that sends "TA" signals
// - This example does not open a display
////////////////////////////////////////////////////////////////////////////////
#include <tscope5.h>
#include <stdio.h>
int main()
{
// set the log level to some high value
ts5_set_log_level(TS5_LOGLEVEL_4);
// register cedrusbox port 1 as a trigger input device
// turn on trigger input simulation
// send TA every 0.1 seconds
// comment this out if you want to receive real triggers
// from a cedrusbox
// wait for 10 triggers
int trigger=0;
double trigtime, timing_error;
int i;
for (i=0; i<10; i++) {
trigger = ts5_wait_for_trigger(&trigtime, &timing_error);
printf("trigger %d %f %f\n", trigger, trigtime, timing_error);
}
// write (append) all triggers to a log file
ts5_write_all_triggers("cedrusbox_triggers.txt");
return 0;
}