root/lm-sensors/trunk/prog/matorb/displayit.pl @ 483

Revision 483, 0.8 KB (checked in by phil, 14 years ago)

(Phil) This is a simple Perl script which reads standard input and sends
the results to the display. Only the first four lines are read, and only
the first 20 chars of each line are displayed.

Example use:

echo -e "hi\nthere,\nhow are\nyou?" | displayit.pl

Displays this on the display:

hi
there,
how are
you?

It doesn't get much simpler than this!

TODO: The code isn't very efficient and goes slow for what it is doing.
It assumes that the display is 20x4 (easily changable). And, it assumes
that there is only one display. This is really more of a simple example
than a feature-rich app.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
RevLine 
[483]1#!/usr/bin/perl
2
3# This is a simple perl script to display a 'screen'
4# on a Matrix Orbital Display.  In this case, this
5# script will read the first four lines (up to 20
6# chars a line) and display them on the display.
7
8# Written and copywritten (C) by Philip Edelbrock, 1999.
9
10
11# Clear the screen
12$temp=`echo  "254 88" > /proc/sys/dev/sensors/matorb*/disp`;
13
14# Turn off the blinking cursor
15$temp=`echo  "254 84" > /proc/sys/dev/sensors/matorb*/disp`;
16
17$line=1;
18
19while (<STDIN>) {
20# Reset the position of the cursor to the next line
21$temp=`echo "254 71 1 $line" > /proc/sys/dev/sensors/matorb*/disp`;
22 if (/^(.{1,20})/) {
23  $_=$1;
24  while (/(.)/gc) {
25   $temp=ord($1);
26   $temp=`echo "$temp" > /proc/sys/dev/sensors/matorb*/disp`;
27  }
28 }
29 $line= $line + 1;
30 if ($line > 4) { exit; }
31}
Note: See TracBrowser for help on using the browser.