Overview
Vivid, flashing lights are a great way to draw attention to something critical or otherwise important. fit-statUSB can blink using vivid colors, and, as a result, fit-statUSB is an excellent tool for getting someone's attention.
This post includes a perl app which demonstrates some of fit-statUSB's blinking capabilities. The user can select the first color, second color, speed, and first color on- time. Many combinations are possible.
Examples
Red/Blue Blinking - 500 mSec Period and First Color On 50% Of Time
Many Combinations Are Possible
Perl App
#!/usr/bin/perl -w
#
#fitStatBlink.pl
# Darryl Hassell 8/11/2018
use Tk;
use Device::SerialPort;
use Time::HiRes ('sleep');
# Define & Initialize Variables
our $first_color = 'FF0000';
our $second_color = '0000FF';
our $speed = 50;
our $period = 1000;
our $first_color_percent = 50;
our $first_color_on = 500;
our $second_color_on = 500;
# Configure Serial Port
my $port = Device::SerialPort -> new("/dev/ttyACM0");
$port -> baudrate(115200);
$port -> databits(8);
$port -> parity("none");
$port -> stopbits(1);
$port -> write_settings;
# Set Sleep Delay After Writes in Seconds
our $delay = 0.1;
#Initialize fit-statUSB to 10 mSec Fade
$port -> write("F10\n");
$port -> purge_rx;
sleep(0.5);
# Initialize fit-statUSB to Max Brightness White
$port -> write("#FFFFFF\n");
$port -> purge_rx;
sleep(1);
$port -> write("#000000\n");
# Create Main Window
$WinMain = MainWindow->new;
$WinMain -> resizable (0,0);
# Label Main Window
$myframe_label = $WinMain -> Frame ->pack();
$myframe_label -> Label (-text => 'fit-statUSB Blink Demo', -foreground => "black", -font => "helvetica 15 bold")->pack(-ipadx => 10,-ipady => 5);
# Create 1st Color Program Window and Buttons
$myframe_first_color = $WinMain -> Frame (-relief => 'groove', -bd => 5);
$myframe_first_color -> Label(-text => 'First Color', -foreground => 'black', -font => "helvetica 12 bold") -> pack ();
# Red Color Select Button
$first_red_button = $myframe_first_color -> Button (-text => ' Red ', -command => \&First_Red_button, -foreground => 'black', -background => 'gray');
$first_red_button -> pack (-side => 'left', -padx => 5, -pady => 5);
# Green Color Select Button
$first_green_button = $myframe_first_color -> Button (-text => 'Green', -command => \&First_Green_button, -foreground => 'black', -background => 'gray');
$first_green_button -> pack (-side => 'left', -padx => 5, -pady => 5);
# Blue Color Select Button
$first_blue_button = $myframe_first_color -> Button (-text => 'Blue', -command => \&First_Blue_button, -foreground => 'black', -background => 'gray');
$first_blue_button -> pack (-side => 'left', -padx => 5, -pady => 5);
# White Color Select Button
$first_white_button = $myframe_first_color -> Button (-text => 'White', -command => \&First_White_button, -foreground => 'black', -background => 'gray');
$first_white_button -> pack (-side => 'left', -padx => 5, -pady => 5);
# Off Color Select Button
$first_off_button = $myframe_first_color -> Button (-text => ' Off ', -command => \&First_Off_button, -foreground => 'black', -background => 'gray');
$first_off_button -> pack (-side => 'left', -padx => 5, -pady => 5);
$myframe_first_color -> pack (-side => 'top');
$myframe_first_color -> pack (-padx => 10, -pady => 5);
# Create 2cnd Color Program Window and Buttons
$myframe_second_color = $WinMain -> Frame (-relief => 'groove', -bd => 5);
$myframe_second_color -> Label(-text => 'Second Color', -foreground => 'black', -font => "helvetica 12 bold") -> pack ();
# Red Color Select Button
$second_red_button = $myframe_second_color -> Button (-text => ' Red ', -command => \&Second_Red_button, -foreground => 'black', -background => 'gray');
$second_red_button -> pack (-side => 'left', -padx => 5, -pady => 5);
# Green Color Select Button
$second_green_button = $myframe_second_color -> Button (-text => 'Green', -command => \&Second_Green_button, -foreground => 'black', -background => 'gray');
$second_green_button -> pack (-side => 'left', -padx => 5, -pady => 5);
# Blue Color Select Button
$second_blue_button = $myframe_second_color -> Button (-text => 'Blue', -command => \&Second_Blue_button, -foreground => 'black', -background => 'gray');
$second_blue_button -> pack (-side => 'left', -padx => 5, -pady => 5);
# White Color Select Button
$second_white_button = $myframe_second_color -> Button (-text => 'White', -command => \&Second_White_button, -foreground => 'black', -background => 'gray');
$second_white_button -> pack (-side => 'left', -padx => 5, -pady => 5);
# Off Color Select Button
$second_off_button = $myframe_second_color -> Button (-text => ' Off ', -command => \&Second_Off_button, -foreground => 'black', -background => 'gray');
$second_off_button -> pack (-side => 'left', -padx => 5, -pady => 5);
$myframe_second_color -> pack (-side => 'top');
$myframe_second_color -> pack (-padx => 10, -pady => 5);
# Create Speed Program Window and Slider
$myframe_speed = $WinMain -> Frame (-relief => 'groove', -bd => 5);
# Speed-% Slider
$speed = 50;
$myframe_speed -> Scale(
-label => 'Speed - %',
-font => 'helvetica 10 bold',
-orient => 'horizontal',
-from => 0,
-to => 100,
-digits =>1,
-resolution => 0.05,
-tickinterval => 20,
-showvalue => 'yes',
-length => '3.5i',
-variable => \$speed,
-command => sub{ print "Speed - %: $speed\n"; }
) -> pack( -side => 'top' );
$myframe_speed -> pack (-side => 'top');
$myframe_speed -> pack (-padx => 2, -pady => 5);
# Create First Color Time Program Window and Slider
$myframe_first_color = $WinMain -> Frame (-relief => 'groove', -bd => 5);
# First Color % Slider
$first_color_percent = 50;
$myframe_first_color -> Scale(
-label => 'First Color On Time - %',
-font => 'helvetica 10 bold',
-orient => 'horizontal',
-from => 0,
-to => 100,
-digits =>1,
-resolution => 0.05,
-tickinterval => 20,
-showvalue => 'yes',
-length => '3.5i',
-variable => \$first_color_percent,
-command => sub{ print "First Color On Time - %: $first_color_percent\n"; }
) -> pack( -side => 'top' );
$myframe_first_color -> pack (-side => 'top');
$myframe_first_color -> pack (-padx => 2, -pady => 5);
# Create Write Ctrl Program Window and Buttons
$myframe_control = $WinMain -> Frame (-relief => 'groove', -bd => 5);
$myframe_control -> Label (-text => 'Control Buttons', -foreground => "black", -font => "helvetica 12 bold")->pack(-ipadx => 110,-ipady => 5);
$writebutton = $myframe_control -> Button (-text => 'Write', -command => \&Ctrl_fitstatUSB, -foreground => 'black', -background => 'lightblue');
$writebutton -> pack (-side => 'left', -padx => 10, -pady => 5);
$exitbutton = $myframe_control -> Button (-text => 'Exit', -command => \&Exit, -foreground => 'black', -background => 'lightblue');
$exitbutton -> pack (-side => 'right', -padx => 10, -pady => 5,);
$myframe_control -> pack (-side => 'bottom');
$myframe_control -> pack (-padx => 10, -pady => 5);
# $WinMain -> repeat(500);
MainLoop();
############### Subroutines ###############
sub Exit {
$port -> write("#000000\n");
$port -> purge_rx;
sleep($delay);
exit;
}
sub First_Red_button {
$first_color = 'FF0000';
$first_red_button -> configure (-foreground => "white", -background => "red");
$first_green_button -> configure (-foreground => "black", -background => "gray");
$first_blue_button -> configure (-foreground => "black", -background => "gray");
$first_white_button -> configure (-foreground => "black", -background => "gray");
$first_off_button -> configure (-foreground => "black", -background => "gray");
sleep($delay);
}
sub First_Green_button {
$first_color = '00FF00';
$first_red_button -> configure (-foreground => "black", -background => "gray");
$first_green_button -> configure (-foreground => "black", -background => "green");
$first_blue_button -> configure (-foreground => "black", -background => "gray");
$first_white_button -> configure (-foreground => "black", -background => "gray");
$first_off_button -> configure (-foreground => "black", -background => "gray");
sleep($delay);
}
sub First_Blue_button {
$first_color = '0000FF';
$first_red_button -> configure (-foreground => "black", -background => "gray");
$first_green_button -> configure (-foreground => "black", -background => "gray");
$first_blue_button -> configure (-foreground => "white", -background => "blue");
$first_white_button -> configure (-foreground => "black", -background => "gray");
$first_off_button -> configure (-foreground => "black", -background => "gray");
sleep($delay);
}
sub First_White_button {
$first_color = 'FFFFFF';
$first_red_button -> configure (-foreground => "black", -background => "gray");
$first_green_button -> configure (-foreground => "black", -background => "gray");
$first_blue_button -> configure (-foreground => "black", -background => "gray");
$first_white_button -> configure (-foreground => "black", -background => "white");
$first_off_button -> configure (-foreground => "black", -background => "gray");
sleep($delay);
}
sub First_Off_button {
$first_color = '000000';
$first_red_button -> configure (-foreground => "black", -background => "gray");
$first_green_button -> configure (-foreground => "black", -background => "gray");
$first_blue_button -> configure (-foreground => "black", -background => "gray");
$first_white_button -> configure (-foreground => "black", -background => "gray");
$first_off_button -> configure (-foreground => "white", -background => "black");
sleep($delay);
}
sub Second_Red_button {
$second_color = 'FF0000';
$second_red_button -> configure (-foreground => "white", -background => "red");
$second_green_button -> configure (-foreground => "black", -background => "gray");
$second_blue_button -> configure (-foreground => "black", -background => "gray");
$second_white_button -> configure (-foreground => "black", -background => "gray");
$second_off_button -> configure (-foreground => "black", -background => "gray");
sleep($delay);
}
sub Second_Green_button {
$second_color = '00FF00';
$second_red_button -> configure (-foreground => "black", -background => "gray");
$second_green_button -> configure (-foreground => "black", -background => "green");
$second_blue_button -> configure (-foreground => "black", -background => "gray");
$second_white_button -> configure (-foreground => "black", -background => "gray");
$second_off_button -> configure (-foreground => "black", -background => "gray");
sleep($delay);
}
sub Second_Blue_button {
$second_color = '0000FF';
$second_red_button -> configure (-foreground => "black", -background => "gray");
$second_green_button -> configure (-foreground => "black", -background => "gray");
$second_blue_button -> configure (-foreground => "white", -background => "blue");
$second_white_button -> configure (-foreground => "black", -background => "gray");
$second_off_button -> configure (-foreground => "black", -background => "gray");
sleep($delay);
}
sub Second_White_button {
$second_color = 'FFFFFF';
$second_red_button -> configure (-foreground => "black", -background => "gray");
$second_green_button -> configure (-foreground => "black", -background => "gray");
$second_blue_button -> configure (-foreground => "black", -background => "gray");
$second_white_button -> configure (-foreground => "black", -background => "white");
$second_off_button -> configure (-foreground => "black", -background => "gray");
sleep($delay);
}
sub Second_Off_button {
$second_color = '000000';
$second_red_button -> configure (-foreground => "black", -background => "gray");
$second_green_button -> configure (-foreground => "black", -background => "gray");
$second_blue_button -> configure (-foreground => "black", -background => "gray");
$second_white_button -> configure (-foreground => "black", -background => "gray");
$second_off_button -> configure (-foreground => "white", -background => "black");
sleep($delay);
}
sub Ctrl_fitstatUSB {
$period = 1000 - (1000*($speed/100));
$first_color_on = $period * ($first_color_percent/100);
$second_color_on = $period - $first_color_on;
my $blinkstring = "B"."#".$first_color."-".$first_color_on."#".$second_color."-".$second_color_on;
print "$blinkstring\n";
$port -> write("$blinkstring\n");
$port -> purge_rx;
}
Conclusions
1. The blinking capability of fit-statUSB can be very effective for bringing attention to critical situations.
2. fit-statUSB is a very versatile,cost-effective visual notification device.
fit-statUSB: Perl Blink Demo
programmable multi-color LED that plugs into a USB port
-
- Posts: 106
- Joined: Mon May 28, 2012 12:25 pm
Jump to
- Announcements
- ↳ Read me first
- ↳ News
- ↳ Ordering
- Tensor-PC
- ↳ General Tensor-PC questions
- ↳ Tensor-PC Hardware
- ↳ Tensor-PC Software
- fitlet3
- ↳ General fitlet3 questions
- ↳ fitlet3 hardware
- ↳ fitlet3 software
- ↳ fitlet3 FACET Cards
- Airtop3
- ↳ General Airtop3 questions
- ↳ Airtop3 Hardware
- ↳ Airtop3 Software
- ↳ Airtop3 I3M
- fitlet2 and MBM2
- ↳ General fitlet2 questions
- ↳ fitlet2 hardware
- ↳ fitlet2 software
- ↳ fitlet2 FACET Cards
- ↳ Cool stuff with fitlet2
- Airtop2
- ↳ General Airtop2 questions
- ↳ Airtop2 Software
- ↳ Airtop2 Hardware
- ↳ Airtop2 I3M
- Mature products
- ↳ Airtop
- ↳ General Airtop questions
- ↳ I3M
- ↳ IPC2 (Intense PC2)
- ↳ General IPC2 questions
- ↳ IPC2 availability
- ↳ IPC2 Hardware
- ↳ Linux on IPC2
- ↳ Windows on IPC2
- ↳ Other operating systems on IPC2
- ↳ IPC2 BIOS
- ↳ IPC2 faults and troubleshooting
- ↳ Intense PC and MintBox 2
- ↳ General Intense PC questions
- ↳ Intense PC hardware
- ↳ CPU & Chipset
- ↳ Display interface
- ↳ Memory
- ↳ Storage
- ↳ Ethernet
- ↳ WLAN and miniPCI-e
- ↳ Audio
- ↳ USB
- ↳ Power and heat
- ↳ Linux on Intense PC
- ↳ Linux Mint
- ↳ Other distributions
- ↳ Windows on Intense PC
- ↳ Win7 on Intense PC
- ↳ Win8 on Intense PC
- ↳ Audio
- ↳ Intense PC BIOS
- ↳ Android on Intense PC
- ↳ Intense PC faults and troubleshooting
- ↳ fitlet and MintBox Mini
- ↳ General fitlet questions
- ↳ fitlet performance
- ↳ fitlet hardware
- ↳ Memory
- ↳ Storage
- ↳ Power and heat
- ↳ Mechanical
- ↳ fitlet BIOS
- ↳ Linux on MintBox Mini / Linux on fitlet
- ↳ Windows on fitlet
- ↳ Other operating systems on fitlet
- ↳ FACET Cards
- ↳ fitlet compatible devices
- ↳ Cool stuff with fitlet
- ↳ fitlet faults and troubleshooting
- ↳ fit-PC4
- ↳ General fit-PC4 questions
- ↳ fit-PC4 hardware
- ↳ Windows on fit-PC4
- ↳ Linux on fit-PC4
- ↳ Other operating systems on fit-PC4
- ↳ fit-PC4 BIOS
- ↳ fit-PC4 faults and troubleshooting
- ↳ fit-PC3
- ↳ General fit-PC3 questions
- ↳ fit-PC3 hardware
- ↳ Display interface
- ↳ Storage
- ↳ Audio
- ↳ WLAN and miniPCI-e
- ↳ USB
- ↳ Power and Heat
- ↳ Ethernet
- ↳ Windows on fit-PC3
- ↳ Linux on fit-PC3
- ↳ Other operating systems on fit-PC3
- ↳ fit-PC3 BIOS
- ↳ fit-PC3 accessories
- ↳ Using fit-PC3
- ↳ fit-PC3 faults and troubleshooting
- ↳ fit-PC2
- ↳ General fit-PC2 questions
- ↳ Buying fit-PC2
- ↳ Linux on fit-PC2
- ↳ Linux Mint
- ↳ Ubuntu 9.10
- ↳ Ubuntu 10.04
- ↳ Ubuntu 10.10
- ↳ Ubuntu 11.04
- ↳ Other Linux distributions
- ↳ Ubuntu 8.04
- ↳ Ubuntu 9.04
- ↳ Display driver
- ↳ Multimedia in Linux
- ↳ Multimedia in Mint
- ↳ Windows on fit-PC2
- ↳ Windows 7
- ↳ Windows 7 display driver
- ↳ Audio in Win7
- ↳ Windows XP
- ↳ XP installation
- ↳ Display driver
- ↳ Video playback
- ↳ Audio in XP
- ↳ Other Windows versions
- ↳ Other operating systems on fit-PC2
- ↳ FreeBSD
- ↳ fit-PC2 hardware
- ↳ fit-PC2i hardware
- ↳ Display interface
- ↳ Storage
- ↳ Audio
- ↳ WLAN and miniPCI-e
- ↳ USB
- ↳ Auto-ON
- ↳ Power and Heat
- ↳ Ethernet
- ↳ RTC & System clock
- ↳ fit-PC2 BIOS
- ↳ BIOS updates fit-PC2
- ↳ BIOS updates fit-PC2i
- ↳ fit-PC2 accessories
- ↳ Using fit-PC2
- ↳ HTPC
- ↳ Server
- ↳ Control
- ↳ Verified displays
- ↳ Car PC
- ↳ fit-PC1 questions
- ↳ fit-PC Slim questions
- ↳ uSVR
- ↳ General uSVR questions
- ↳ IPC3
- ↳ General IPC3 questions
- ↳ IPC3 Software
- ↳ IPC3 Hardware
- ↳ FACE modules
- ↳ FACE Modules
- ↳ General FACE Module questions
- Compulab accessories
- ↳ fit-Headless and fit-Headless 4K
- ↳ fit-Uptime
- ↳ fit-statUSB
- ECN/PCN
- ↳ fitlet3 ECN/PCN
- ↳ Tensor-I20 ECN/PCN
- ↳ Tensor-I22 ECN/PCN
- ↳ fitlet2 ECN/PCN
- ↳ Airtop3 ECN/PCN
- ↳ IPC3 ECN
- ↳ fitlet1 ECN
- ↳ IPC2 ECN
- ↳ IPC1 ECN
- ↳ Airtop2 ECN
- ↳ Airtop1 ECN
- ↳ fit-PC4 ECN
- ↳ fit-PC3 ECN
- ↳ fit-PC2 ECN
- ↳ FACE Modules ECN
- ↳ FACET Cards ECN
- Wish list
- ↳ Addressed requests