Skip to content

Instantly share code, notes, and snippets.

@jarrodbell
Created June 13, 2012 16:02
Show Gist options
  • Save jarrodbell/2924984 to your computer and use it in GitHub Desktop.
Save jarrodbell/2924984 to your computer and use it in GitHub Desktop.
Delaying color picker commands
// 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\x­03\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\x­03\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\x­03\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