Tscope5
Main Page
Related Pages
Files
Examples
timer01.c
////////////////////////////////////////////////////////////////////////////////
//
// __ ______
// / /_______________ ____ ___ / ____/
// / __/ ___/ ___/ __ \/ __ \/ _ \ /___ )
// / /_(__ ) /__/ /_/ / /_/ / __/ ____/ /
// \__/____/\___/\____/ .___/\___/ /_____/
// /_/
//
// timer01.c
// - Illustration of the wait functions.
////////////////////////////////////////////////////////////////////////////////
#include <tscope5.h>
int
main()
{
// open a display
ts5_install_display
();
// normal wait function
ts5_printf
(0.0, 0.0,
"wait 2 seconds"
);
ts5_flip_display
();
ts5_wait
(2.0);
// get time since the start of the program
double
tm =
ts5_get_time
();
ts5_clear_display
();
ts5_printf
(0.0, 0.0,
"the program has been running for %f seconds now"
, tm);
ts5_flip_display
();
// wait until function
tm += 2.0;
ts5_wait_until
(tm);
ts5_clear_display
();
ts5_printf
(0.0, 0.0,
"another 2 seconds have elapsed now"
);
// wait for a click
ts5_draw_mouse_button
(ax(0.9), ay(-0.8));
return
0;
}