summaryrefslogtreecommitdiff
path: root/bin/mimosawatch
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2017-04-03 15:04:15 +0200
committerDaniel Friesel <derf@finalrewind.org>2017-04-03 15:04:15 +0200
commit00e57331b1c7ef2b1f402f41e1223308e0d8ce61 (patch)
tree05e9b4223072582a5a6843de6d9845213a94f341 /bin/mimosawatch
initial commit
Diffstat (limited to 'bin/mimosawatch')
-rwxr-xr-xbin/mimosawatch24
1 files changed, 24 insertions, 0 deletions
diff --git a/bin/mimosawatch b/bin/mimosawatch
new file mode 100755
index 0000000..88d34a3
--- /dev/null
+++ b/bin/mimosawatch
@@ -0,0 +1,24 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use 5.020;
+
+use File::Slurp qw(slurp);
+use IO::Handle;
+
+our $VERSION = '0.00';
+
+STDOUT->autoflush(1);
+
+while (sleep(1)) {
+ if ( -e '/tmp/mimosa/mimosa_scale_100000.tmp' ) {
+ my $raw_data = slurp('/tmp/mimosa/mimosa_scale_100000.tmp');
+ my @data = map { $_ >> 8 } unpack('L*', $raw_data);
+ my @buzzer = map { $_ & 0x0f } unpack('L*', $raw_data);
+
+ if (@data > 8) {
+ printf("\r\e[2K" . ('%8d ' x 8), @data[-8 .. -1]);
+ }
+ }
+}