From e9c1b45a44f342729abb5e8b4b4978549e8e35b5 Mon Sep 17 00:00:00 2001 From: Philip Edelbrock Date: Wed, 16 Jun 1999 06:25:31 +0000 Subject: [PATCH] (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. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@483 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/matorb/displayit.pl | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 prog/matorb/displayit.pl diff --git a/prog/matorb/displayit.pl b/prog/matorb/displayit.pl new file mode 100755 index 00000000..3641cd74 --- /dev/null +++ b/prog/matorb/displayit.pl @@ -0,0 +1,31 @@ +#!/usr/bin/perl + +# This is a simple perl script to display a 'screen' +# on a Matrix Orbital Display. In this case, this +# script will read the first four lines (up to 20 +# chars a line) and display them on the display. + +# Written and copywritten (C) by Philip Edelbrock, 1999. + + +# Clear the screen +$temp=`echo "254 88" > /proc/sys/dev/sensors/matorb*/disp`; + +# Turn off the blinking cursor +$temp=`echo "254 84" > /proc/sys/dev/sensors/matorb*/disp`; + +$line=1; + +while () { +# Reset the position of the cursor to the next line +$temp=`echo "254 71 1 $line" > /proc/sys/dev/sensors/matorb*/disp`; + if (/^(.{1,20})/) { + $_=$1; + while (/(.)/gc) { + $temp=ord($1); + $temp=`echo "$temp" > /proc/sys/dev/sensors/matorb*/disp`; + } + } + $line= $line + 1; + if ($line > 4) { exit; } +}