in reply to Perl and Can Bus
If you want to output the bytes received for 0CFFE000 and 18FEF501 onto a fixed screen position, the following could help. It's a very simplicistic approach:
open my $can_bus, "./receivetest |" or die "Couldn't read from CAN bus: $!"; my %last_value; while( <$can_bus>) { if( /^(........:...) (........) (.*)$/ ) my( $something, $id, $payload)= ($1,$2,$3); $last_value{ $id }= $payload; system('clear'); # clear screen # print the table for my $id (sort keys %last_value) { print "$id\t$last_value{ $id }\n"; }; } else { warn "Ignoring unknown line:"; warn $_; }; };
If you want something fancier than the flickering screen, you'll have to look at Curses (or NCurses).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl and Can Bus
by Jalcock501 (Sexton) on Dec 12, 2014 at 16:25 UTC | |
by Corion (Patriarch) on Dec 12, 2014 at 18:43 UTC | |
by Jalcock501 (Sexton) on Dec 15, 2014 at 09:42 UTC | |
by Corion (Patriarch) on Dec 15, 2014 at 10:01 UTC |