-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHueTest3.js
84 lines (72 loc) · 1.36 KB
/
HueTest3.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
var hue = require('./hueanimation');
var beach = {
'hue': 17000,
'sat': 150,
'bri': 254,
'on': true }
var beach_accent = {
'hue': 55000,
'sat': 254,
'bri': 254 }
var sunset = {
'hue': 15000,
'sat': 254,
'bri': 254,
'on': true }
var sunset_accent = {
'hue': 5000,
'sat': 254,
'bri': 254 }
var fishbowl = {
'hue': 47000,
'sat': 254,
'bri': 254,
'on': true }
var fishbowl_accent = {
'hue': 0,
'sat': 254,
'bri': 254 }
var nightlight = {
'hue': 0,
'sat': 254,
'bri': 254,
'on': false }
var nightlight_accent = {
'hue': 0,
'sat': 254,
'bri': 0,
'on': true }
var disco = function(){
return {
'hue': randomInt(0,62000),
'sat': 254,
'bri': 254,
'on': true };
}
function randomInt (low, high) {
return Math.floor(Math.random() * (high - low + 1) + low);
}
var manager = hue.FishbowlManager({
'start_state': function(light){
/*console.log (light);
if (light.index % 2 == 1) {
console.log('blue light');
return fishbowl;
} else {
console.log('red light');*/
return sunset;
//}
},
'next_state': function(light){
return fishbowl_accent;
}/*,
'next_timeout': function(light){
return 10000;
},
'next_speed': function(light){
return 10000;
}*/
});
hue.init(function(){
manager.start();
}, [6,7]);