The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Device::BlinkStick::Stick

SYNOPSIS

use 5.10.0 ;
use strict ;
use warnings ;
use Device::BlinkStick;

my $bs = Device::BlinkStick->new() ;
# get the first blinkstick found
my $device = $bs->first() ;
# make it red
$first->set_color( 'red') ;

sleep( 2) ;
# blink red for 5s (5000ms) on and off for 250ms
$first->blink( 'red', 5000, 250) ;    

DESCRIPTION

Object holding information and control about a specic blinkstick device

See Also

left to do from python version

def _usb_get_string(self, device, length, index):
def get_led_data(self):
def data_to_message(self, data):
def set_random_color(self):
def turn_off(self):
def blink(self, red=0, green=0, blue=0, name=None, hex=None, repeats=1, delay=500):
new

Create an instance of a blink stick device, requires an open USB file device

verbose

output some debug as things happen

serial_number

optionally find this stick

device_name

optionally find this stick, if serial_number is also defined that will over-ride I am working on the premise that the device name is stored in info_block_1

info

get a hash of info about the device

get_device_name

get the contents of info_block_1, usually the device name?

get_access_token

get the contents of get_info_block_2, maybe the acccess token for the online service? unused for perl

set_device_name
str

string to write into info_block_1, the device name

This will get trimmed to 32 characters

returns true/false depending if the string was set

set_access_token
str

string to write into info_block_2, the online access token. Not used by perl

This will get trimmed to 32 characters

returns true/false depending if the string was set

get_mode

returns the display mode

0 normal 1 inverse 2 WS2812 3 WS2812 mirror - all leds the same

set_mode

Set the display mode

mode

mode to set

0 normal 1 inverse 2 WS2812 3 WS2812 mirror - all leds the same

returns true/false depending if the mode was set

get_color

returns the color as rgb

set_color

set the rgb color for a single pixel blinkstick, uses brightness

r

red part 0..255

g

green part 0..255

b

blue part 0..255

channel

64 LED block to use

index

LED in block to use

returns true/false depending if the mode was set

get_leds

returns the number of leds on the device

set_leds

set the number of leds connected to a device

count

0..64

returns true/false depending if the led count was set

1 POD Error

The following errors were encountered while parsing the POD:

Around line 577:

'=item' outside of any '=over'

=over without closing =back