[Chicago-talk] Hello World example for PERL Module

Shlomi Fish shlomif at shlomifish.org
Tue Oct 5 22:07:29 PDT 2021


Hi Richard,

On Tue, 05 Oct 2021 10:42:47 -0400
"Richard Reina" <richard at rushlogistics.com> wrote:

> Can someone help me out with a Hello World example for this module?
> https://metacpan.org/dist/Device-Blinkytape/view/lib/Device/BlinkyTape/SimulationPort.pm
> 
> I have used BlinkyTape.pm (like in the code below) but now I would like to do
> some testing on a machine that does not have a BlinkyTape plugged into it's
> USB port and am not sure how to get started with BlinkyTape/SimulationPort.pm
> 
> Thanks for any help.
> 
> use strict;
> use lib '/home/pi/';
> use BlinkyTape;
> 
> use Time::HiRes qw / usleep /;
> my $bb = Device::BlinkyTape::WS2811->new();
>  
> for (my $b=0; $b<=100000; $b++) {
>     for (my $a=0; $a<=59; $a++) {

Tangential comment, but see
https://perl-begin.org/tutorials/bad-elements/#vars-a-and-b .

Also , for reproducible results, you may wish to use srand() or better yet
https://metacpan.org/pod/Math::Random::MT or similar.

>         $bb->send_pixel(int(rand(254)),int(rand(254)),int(rand(254)));
>     }
>     $bb->show(); # shows the sent pixel row.
>     usleep(400000);
> }
>  
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> https://mail.pm.org/mailman/listinfo/chicago-talk



-- 

Shlomi Fish       https://www.shlomifish.org/
https://github.com/shlomif/validate-your-html - Validate Your HTML

As it turns out, compiling a C program from more than 20 years ago is actually
a lot easier than getting a Rails app from last year to work.
    — https://passy.svbtle.com/building-vim-from-1993-today

Please reply to list if it's a mailing list post - https://shlom.in/reply .


More information about the Chicago-talk mailing list