From daf966eaa629d59487b57f907b62f642995d829e Mon Sep 17 00:00:00 2001 From: Astrid Smith Date: Fri, 28 Oct 2011 21:44:42 -0700 Subject: Calibrator, version that works (kind of) with milliseconds --- client.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 client.c (limited to 'client.c') diff --git a/client.c b/client.c new file mode 100644 index 0000000..2b3ff4c --- /dev/null +++ b/client.c @@ -0,0 +1,29 @@ +/* Thinger to read 60hz cycle times and display diagnostics in a kind + * of stripcharty way. + */ + +#include +#include +#include + + +int main(int *argc, char **argv) +{ + char line[20]; + double bottom = 1/59.9; + double top = 1/60.1; + double center = 1/60; + int fd = open("/dev/ttyACM0", O_RDONLY); + + while (1) { + double current; + char* line = " | \n"; + int len = read(fd, &line, 20); + if (len == 0) { + puts("Fucked\n"); + continue; + } + current = (float)atoi(&line); + printf("%f %f\n", current - bottom, current); + } +} -- cgit v1.2.3