Created
June 13, 2012 16:02
-
-
Save jarrodbell/2924984 to your computer and use it in GitHub Desktop.
Delaying color picker commands
This file contains 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
// Push the modules into the startup process | |
CF.modules.push({name: "Color Picker", object: ColorPicker}); | |
var myColorPicker; | |
// Only one CF.userMain function in all scripts is allowed! | |
// If you have one already in your project, consolidate all their contents into one CF.userMain function | |
CF.userMain = function () { | |
myColorPicker = new ColorPicker("colorpicker.png", "s1", 750, function(r, g, b, x, y) { | |
// This code will be run everytime the pixel color is obtained, along with the pixel data as parameters | |
CF.send("AppleKNX", "\x06\x20\xF0\x80\x00\x15\x04\x00\x00\x00\xF0\x06\x01\x32\x00\x01\x01\x32\x03\x01" + String.fromCharCode(r) ); | |
setTimeout(function() { CF.send("AppleKNX", "\x06\x20\xF0\x80\x00\x15\x04\x00\x00\x00\xF0\x06\x01\x33\x00\x01\x01\x33\x03\x01" + String.fromCharCode(g) ); }, 250); | |
setTimeout(function() { CF.send("AppleKNX", "\x06\x20\xF0\x80\x00\x15\x04\x00\x00\x00\xF0\x06\x01\x34\x00\x01\x01\x34\x03\x01" + String.fromCharCode(b) ); }, 500); | |
}); | |
// Setup the colorpicker object after it was created above | |
myColorPicker.setup(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment