summaryrefslogtreecommitdiff
path: root/client.c
diff options
context:
space:
mode:
authorAstrid Smith2011-10-28 21:44:42 -0700
committerAstrid Smith2011-10-28 21:44:48 -0700
commitdaf966eaa629d59487b57f907b62f642995d829e (patch)
tree34003f39525c01f44b3d556eafcba0a0c7ef91cd /client.c
parentad9adb3614e5cc0765bf75c43343e0d4a422c520 (diff)
Calibrator, version that works (kind of) with milliseconds
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);
+ }
+}