diff options
| author | Astrid Smith | 2011-09-11 19:29:50 -0700 |
|---|---|---|
| committer | Astrid Smith | 2011-09-11 19:29:50 -0700 |
| commit | 8130bcc14eefb32f7010c8c42457add9be534c9d (patch) | |
| tree | 263c0032b65dbd2c52bb787a626d938503997e12 /host | |
| parent | e542e1d59b2e98d12bc8193a539a8120bd496042 (diff) | |
foo
Diffstat (limited to 'host')
| -rw-r--r-- | host/client.c | 26 |
1 files changed, 16 insertions, 10 deletions
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 <unistd.h> #include <stdio.h> +#include <string.h> #include <fcntl.h> -#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); + } } } |
