From 8130bcc14eefb32f7010c8c42457add9be534c9d Mon Sep 17 00:00:00 2001 From: Astrid Smith Date: Sun, 11 Sep 2011 19:29:50 -0700 Subject: foo --- host/client.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'host/client.c') diff --git a/host/client.c b/host/client.c index 29a2455..42a1f72 100644 --- a/host/client.c +++ b/host/client.c @@ -4,14 +4,16 @@ #include #include +#include #include -#define QUEUE 100 +#define QUEUE 60 #define WIDTH 40 int main(int *argc, char **argv) { char line[WIDTH + 10]; + char blankline[] = " | "; double bottom = 1000000/59.9; double top = 1000000/60.1; double center = 1000000/60; @@ -20,9 +22,11 @@ int main(int *argc, char **argv) int qpos = 0; int fd = open("/dev/ttyACM0", O_RDONLY); + strcpy(&line, &blankline); + + while (1) { double current, average; - char line[] = " | "; char inlin[20]; int position, pos_avg, i; int len = read(fd, &inlin, 20); @@ -52,14 +56,16 @@ int main(int *argc, char **argv) line[position] = '.'; } - if (pos_avg > WIDTH) { - line[WIDTH] = '_'; - } else if (pos_avg < 0) { - line[0] = '_'; - } else { - line[pos_avg] = '*'; - } - if (counter % 15 == 0) + if (counter % 6 == 0) { + if (pos_avg > WIDTH) { + line[WIDTH] = '_'; + } else if (pos_avg < 0) { + line[0] = '_'; + } else { + line[pos_avg] = '#'; + } printf("[%s] %f\n", line, 1/(average/1000000)); + strcpy(&line, &blankline); + } } } -- cgit v1.2.3