NAME
Device::BlinkStick
SYNOPSIS
use
5.10.0 ;
use
strict ;
use
warnings ;
use
Device::BlinkStick;
my
$bs
= Device::BlinkStick->new() ;
# set first LED on all devices to blue
my
$all_devices
=
$bs
->devices() ;
foreach
my
$k
(
keys
%$all_devices
) {
$all
->{
$k
}->set_color(
'blue'
) ;
}
# get the first blinkstick found
my
$device
=
$bs
->first() ;
# make it red
$first
->led(
color
=>
'red'
) ;
sleep
( 2) ;
# blink red for 5 times, delaying for 250ms between black and the color
$first
->blink(
color
=>
'red'
,
delay
=> 250,
times
=> 5) ;
DESCRIPTION
Module to control a number of blinkstick devices http://blinkstick.com connected via USB.
new
Instantiate a new object, also finds all currently connected devices and populates the accessor method variables
parameters
access methods
- devices
-
Get all blinkstick device Device::BlinkStick::Stick objects available as a hash ref
my
$bs
= Device::BlinkStick->new() ;
my
$devices
=
$bs
->devices() ;
- first
-
Get the first blink stick device (object Device::BlinkStick::Stick) found
my
$bs
= Device::BlinkStick->new() ;
my
$device
=
$bs
->first() ;
# make it red
$first
->led(
color
=>
'red'
) ;
refresh_devices
Check the USB for any added or removed devices and update our internal list
Returns all blinkstick device objects available as a hash ref
my
$bs
= Device::BlinkStick->new() ;
my
$current
=
$bs
->refresh_devices() ;
find
Find a device by name or serial number
my
$bs
= Device::BlinkStick->new() ;
my
$d
=
$bs
->find(
'strip'
) ;
# I have a device I've named strip!
$d
->set_mode( 3) ;
$d
->led(
color
=>
'green'
) ;
# set all LEDs to green
Returns undef if fails to match a device