1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
#!/usr/bin/perl
use strict;
use warnings;
use HiPi::Interface::MicroDotPHAT;
my $phat = HiPi::Interface::MicroDotPHAT->new();
print q(Vertical Text
Scrolls text messages vertically.
Press Ctrl+C to exit.
);
my @lines = qw( One Two Three Four Five );
# $line_height 9 gives 2 pixel vertical spacing for rows
my $line_height = 9;
for(my $i = 0; $i < @lines; $i ++ ) {
$phat->write_string( $lines[$i], 0, $i * $line_height, 0);
}
$phat->show;
while (1) {
$phat->sleep_milliseconds( 1000 );
my $iter = 0;
while( $iter < $line_height ) {
$iter++;
$phat->scroll_vertical();
$phat->show();
$phat->sleep_milliseconds( 50 );
}
}
1;
|