summaryrefslogtreecommitdiff
path: root/bin/mimosawatch
blob: 88d34a342bd7fdd5113b7c635ddf92d941ad5d6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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]);
		}
	}
}