This is a PHP class to communicate with the blink(1) command line tool, available here
Check out a video of the Blink(1) running the example code
The following is required in order for PHP to communicate with the command link tool
- Open Terminal.app and type
sudo visudo
then enter you password - Navigate to the
# User privilege specification
section and hiti
to insert - Type
nobody ALL=NOPASSWD: /blink1-tool
(nobody
was the username my PHP was accessing the command line with. To find yours just run the following in your PHP scriptecho exec('whoami');
) - Hit ESC, then type
:wq
- If it says there is an error, hite
and fix it - Place the blink1-tool in the
/
directory
Display #FFF (Turn on) for 2000ms
Blink::send('#FFF,2000');
Display #F68 for 2000ms
Blink::send('#F68,2000');
Blink #F68 for 400ms 5 times
Blink::send('#F68,400',5);
Fade to #F68 for 400ms, fade to #0F1 for 400ms, then fade to #F68 for 400ms - loop 3 times
Blink::send('#F68,400|#0F1,400|#F68,400',3);
Same as above, but with #000 for 50ms between for a 'flicker' effect
Blink::send('#F68,400|#000,50|#ff8920,400|#000,50|#F00,400',3);
Blink(1) testing prior to sending
if(Blink::test()) {
Blink::send('#FFF,2000');
}
Blink(1) testing after sending
$blink = Blink::send('#FFF,2000');
echo ($blink) ? 'Sent' : 'Fail';
- Blink(1) by ThumbM
- Blink(1) API Documentation
- BrandColours for finding the hex colour for the service/API you are displaying an alert for
Blink is licensed under the MIT license, see LICENSE.md for details.