New version of Kitt leds.
Here is the alternate version of the light show resembling Kitt front end demo.
First you need to compile lptout.c
$ gcc lptout.c -o lptout
Create the lightshow.sh shell file
$ editor lightshow.sh
Make it executable with:
$ chmod +x lightshow.sh
then you can invoke shell file with with an argument for the speed of the lights. The larger the number, the slower it runs,
$ sudo /lightshow.sh .2
You can also use the light show emulator
$ ./testshow .5
------------------------------------------------------------
lptout.c
[code]
/*
* Simple parallel port output control program for Linux
* Written and copyright by Tomi Engdahl 1998
* (e-mail: tomi.engdahl@hut.fi)
*
* The program output the data value to PC parallel port data pins
* (default lpt1 I/O address 0x378). The data values are given as the
* command line parameter to the program. The number can be
* in decimal (0..255) or hexadecimal format (0x00..0xFF).
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <asm/io.h>
#define base 0x378 /* printer port base address */
main(int argc, char **argv)
{
int value;
if (argc!=2)
fprintf(stderr, "Error: Wrong number of arguments. This program needs one argument which is number between 0 and 255.\n"), exit(1);
if (sscanf(argv[1],"%i",&value)!=1)
fprintf(stderr, "Error: Parameter is not a number.\n"), exit(1);
if ((value<0) || (value>255))
fprintf(stderr, "Error: Invalid numeric value. The parameter number must be between 0 and 255\n"), exit(1);
if (ioperm(base,1,1))
fprintf(stderr, "Error: Couldn't get the port at %x\n", base), exit(1);
outb((unsigned char)value, base);
}
[/code]
lightshow.sh
[code]
#!/bin/bash
let x="$((2#11111111))"
lptout $x
sleep $1
let x="$((2#00000000))"
lptout $x
sleep $1
echo "infinite loops [ hit CTRL+C to stop]"
for (( ; ; ))
do
let x="$((2#10000000))"
lptout $x
sleep $1
let x="$((2#11000000))"
lptout $x
sleep $1
let x="$((2#01100000))"
lptout $x
sleep $1
let x="$((2#00011000))"
lptout $x
sleep $1
let x="$((2#00001100))"
lptout $x
sleep $1
let x="$((2#00000110))"
lptout $x
sleep $1
let x="$((2#00000011))"
lptout $x
sleep $1
let x="$((2#00000001))"
lptout $x
sleep $1
let x="$((2#00000000))"
lptout $x
sleep $1
let x="$((2#00000001))"
lptout $x
sleep $1
let x="$((2#00000011))"
lptout $x
sleep $1
let x="$((2#00000110))"
lptout $x
sleep $1
let x="$((2#00001100))"
lptout $x
sleep $1
let x="$((2#00011000))"
lptout $x
sleep $1
let x="$((2#00110000))"
lptout $x
sleep $1
let x="$((2#01100000))"
lptout $x
sleep $1
let x="$((2#11000000))"
lptout $x
sleep $1
let x="$((2#10000000))"
lptout $x
sleep $1
let x="$((2#00000000))"
lptout $x
sleep $1
done
let x="$((2#11111111))"
lptout $x
sleep $1
let x="$((2#00000000))"
lptout $x
sleep $1
[/code]
testshow.sh
[code]
#!/bin/bash
clear
tput cup 1 1; echo "11111111"
sleep $1
tput cup 1 1; echo "00000000"
sleep $1
echo "infinite loops [ hit CTRL+C to stop]"
for (( ; ; ))
do
tput cup 1 1; echo "10000000"
sleep $1
tput cup 1 1; echo "11000000"
sleep $1
tput cup 1 1; echo "01100000"
sleep $1
tput cup 1 1; echo "00011000"
sleep $1
tput cup 1 1; echo "00001100"
sleep $1
tput cup 1 1; echo "00000110"
sleep $1
tput cup 1 1; echo "00000011"
sleep $1
tput cup 1 1; echo "00000001"
sleep $1
tput cup 1 1; echo "00000000"
sleep $1
tput cup 1 1; echo "00000001"
sleep $1
tput cup 1 1; echo "00000011"
sleep $1
tput cup 1 1; echo "00000110"
sleep $1
tput cup 1 1; echo "00001100"
sleep $1
tput cup 1 1; echo "00011000"
sleep $1
tput cup 1 1; echo "00110000"
sleep $1
tput cup 1 1; echo "01100000"
sleep $1
tput cup 1 1; echo "11000000"
sleep $1
tput cup 1 1; echo "10000000"
sleep $1
tput cup 1 1; echo "00000000"
sleep $1
done
tput cup 1 1; echo "11111111"
sleep $1
tput cup 1 1; echo "00000000"
sleep $1
[/code]
First you need to compile lptout.c
$ gcc lptout.c -o lptout
Create the lightshow.sh shell file
$ editor lightshow.sh
Make it executable with:
$ chmod +x lightshow.sh
then you can invoke shell file with with an argument for the speed of the lights. The larger the number, the slower it runs,
$ sudo /lightshow.sh .2
You can also use the light show emulator
$ ./testshow .5
------------------------------------------------------------
lptout.c
[code]
/*
* Simple parallel port output control program for Linux
* Written and copyright by Tomi Engdahl 1998
* (e-mail: tomi.engdahl@hut.fi)
*
* The program output the data value to PC parallel port data pins
* (default lpt1 I/O address 0x378). The data values are given as the
* command line parameter to the program. The number can be
* in decimal (0..255) or hexadecimal format (0x00..0xFF).
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <asm/io.h>
#define base 0x378 /* printer port base address */
main(int argc, char **argv)
{
int value;
if (argc!=2)
fprintf(stderr, "Error: Wrong number of arguments. This program needs one argument which is number between 0 and 255.\n"), exit(1);
if (sscanf(argv[1],"%i",&value)!=1)
fprintf(stderr, "Error: Parameter is not a number.\n"), exit(1);
if ((value<0) || (value>255))
fprintf(stderr, "Error: Invalid numeric value. The parameter number must be between 0 and 255\n"), exit(1);
if (ioperm(base,1,1))
fprintf(stderr, "Error: Couldn't get the port at %x\n", base), exit(1);
outb((unsigned char)value, base);
}
[/code]
lightshow.sh
[code]
#!/bin/bash
let x="$((2#11111111))"
lptout $x
sleep $1
let x="$((2#00000000))"
lptout $x
sleep $1
echo "infinite loops [ hit CTRL+C to stop]"
for (( ; ; ))
do
let x="$((2#10000000))"
lptout $x
sleep $1
let x="$((2#11000000))"
lptout $x
sleep $1
let x="$((2#01100000))"
lptout $x
sleep $1
let x="$((2#00011000))"
lptout $x
sleep $1
let x="$((2#00001100))"
lptout $x
sleep $1
let x="$((2#00000110))"
lptout $x
sleep $1
let x="$((2#00000011))"
lptout $x
sleep $1
let x="$((2#00000001))"
lptout $x
sleep $1
let x="$((2#00000000))"
lptout $x
sleep $1
let x="$((2#00000001))"
lptout $x
sleep $1
let x="$((2#00000011))"
lptout $x
sleep $1
let x="$((2#00000110))"
lptout $x
sleep $1
let x="$((2#00001100))"
lptout $x
sleep $1
let x="$((2#00011000))"
lptout $x
sleep $1
let x="$((2#00110000))"
lptout $x
sleep $1
let x="$((2#01100000))"
lptout $x
sleep $1
let x="$((2#11000000))"
lptout $x
sleep $1
let x="$((2#10000000))"
lptout $x
sleep $1
let x="$((2#00000000))"
lptout $x
sleep $1
done
let x="$((2#11111111))"
lptout $x
sleep $1
let x="$((2#00000000))"
lptout $x
sleep $1
[/code]
testshow.sh
[code]
#!/bin/bash
clear
tput cup 1 1; echo "11111111"
sleep $1
tput cup 1 1; echo "00000000"
sleep $1
echo "infinite loops [ hit CTRL+C to stop]"
for (( ; ; ))
do
tput cup 1 1; echo "10000000"
sleep $1
tput cup 1 1; echo "11000000"
sleep $1
tput cup 1 1; echo "01100000"
sleep $1
tput cup 1 1; echo "00011000"
sleep $1
tput cup 1 1; echo "00001100"
sleep $1
tput cup 1 1; echo "00000110"
sleep $1
tput cup 1 1; echo "00000011"
sleep $1
tput cup 1 1; echo "00000001"
sleep $1
tput cup 1 1; echo "00000000"
sleep $1
tput cup 1 1; echo "00000001"
sleep $1
tput cup 1 1; echo "00000011"
sleep $1
tput cup 1 1; echo "00000110"
sleep $1
tput cup 1 1; echo "00001100"
sleep $1
tput cup 1 1; echo "00011000"
sleep $1
tput cup 1 1; echo "00110000"
sleep $1
tput cup 1 1; echo "01100000"
sleep $1
tput cup 1 1; echo "11000000"
sleep $1
tput cup 1 1; echo "10000000"
sleep $1
tput cup 1 1; echo "00000000"
sleep $1
done
tput cup 1 1; echo "11111111"
sleep $1
tput cup 1 1; echo "00000000"
sleep $1
[/code]
Comments
Post a Comment