-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathappexample.js
38 lines (30 loc) · 928 Bytes
/
appexample.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var blync = require('blync-usb30');
try {
// How many Blyncs are hooked up?
var deviceCount = blync.getDevices().length;
var device = blync.getDevice(0);
} catch (error) {
throw new Error("Error: " + error);
}
// Make Blync with specific color
device.setColor('white', 'on');
device.setColor('red', 'on');
device.setColor('blue', 'on');
device.setColor('green', 'on');
device.setColor('yellow', 'on');
device.setColor('cyan', 'on');
device.setColor('magenta', 'on');
// Make Blync light up with RGB code
device.setRGB(0,125,200, 'on');
// Make Blync light up with controls
device.setColor('green', 'dim');
device.setColor('green', 'blinkslow');
device.setColor('green', 'blinknormal');
device.setColor('green', 'blinkfast');
// Switch off - Any color is correct
device.setColor('green', 'off');
// Turn Blync off when you exit
process.on( 'SIGINT', function() {
device.turnOff();
process.exit(0);
});