#!/usr/bin/perl -tT # use strict; use warnings; my $senderprogram="blinken-frame-sender"; my $hostname="localhost"; my @array=([],[]); my $rad=2*3.1416; my $angle=0.253; my $line; #for debugging: sub printout { system("clear"); #this only works on Linux for my $r(0..7) { print(" "); for my $c (0..17) { print" "; if ($array[$c][$r]) {print " "}else {print"#"}; } print("\n"); } print("\n"); } #clearing the array sub clear { for my $r(0..7) { for my $c(0..17) { $array[$c][$r]="1"; } } } while(1) { clear(); my ($sec,$min,$hour)=(localtime)[0,1,2]; $hour-=12 if $hour>11; #hour: for my $zeig (0..5) { my $x=sprintf("%.0f",sin($rad*5*$hour/60)*$zeig); my $y=sprintf("%.0f",-cos($rad*5*$hour/60)*$zeig); $array[$x+8][$y+4]="0" if $y+4>-1 && $x+8>-1; } #minute: for my $zeig(0..9) { my $x=sprintf("%.0f",sin($rad*$min/60)*$zeig); my $y=sprintf("%.0f",-cos($rad*$min/60)*$zeig); $array[$x+8][$y+4]="0" if $y+4>-1 && $x+8>-1;# && $x>0 && $y>0; } #seconds: for my $zeig(0..9){ my $x=sprintf("%.0f",sin($rad*$sec/60)*$zeig); my $y=sprintf("%.0f",-cos($rad*$sec/60)*$zeig); $array[$x+8][$y+4]="0" if $y+4>-1 && $x+8>-1; } #everything into one line for my $r(0..7) { for my $c(0..17) { $line.=$array[$c][$r]; } } #send if(system($senderprogram,$hostname,$line)==-1){die "senderprogram $senderprogram didn't work!\n";} #wait a second select(undef,undef,undef,1); $line=""; }