summaryrefslogtreecommitdiff
path: root/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'client.c')
-rw-r--r--client.c29
1 files changed, 29 insertions, 0 deletions
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 <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+
+
+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);
+ }
+}