Created
December 13, 2015 17:06
-
-
Save Pierre-Gilles/1fa9b48657e93226ed82 to your computer and use it in GitHub Desktop.
Star Wars mode for Gladys !
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get remaining days before Star Wars release | |
var t = new Date(2015, 11, 16).getTime() - new Date().getTime(); | |
var days = Math.floor( t/(1000*60*60*24) ); | |
var user = { | |
id: 1, | |
language: 'en' | |
}; | |
if(days > 0) { | |
SpeakService.say('Sir, there are ' + days + ' days until Star Wars release ! Get ready !', user); | |
} else if(days === 0) { | |
SpeakService.say('Sir, Star Wars is available today ! Finally !', user); | |
} | |
// TurnOn Milight Lamp ID 1 | |
MilightService.turnOn(user.id, 1, function(){ | |
// Timeout between two MilightCommand | |
setTimeout(function(){ | |
// Change Lamp color to RED | |
MilightService.hue(1, 170); | |
}, 150); | |
}); | |
// Play Star Wars theme after Gladys has finished speaking | |
setTimeout(function(){ | |
MusicService.play('star_wars.mp3'); | |
// Change light color to green at the beginning of the theme | |
setTimeout(function() { | |
MilightService.hue(1, 80); | |
}, 900); | |
}, 4000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment