Skip to content

Instantly share code, notes, and snippets.

@scarolan
Created April 22, 2016 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scarolan/fa33032812d559d9772f5fffde39a4b3 to your computer and use it in GitHub Desktop.
Save scarolan/fa33032812d559d9772f5fffde39a4b3 to your computer and use it in GitHub Desktop.
//@module
exports.pins = {
blinkm: {type: "I2C", address: 0x09, voltage: 5.0}
}
exports.configure = function() {
this.blinkm.init();
}
exports.close = function() {
this.blinkm.close();
}
exports.sendcmd = function() {
this.blinkm.writeBlock(0x6e,0x10,0x10,0x10);
}
// This also works, but only for 0x6e or immediately set color
/*
exports.sendcmd = function() {
this.blinkm.writeByte(0x6e);
this.blinkm.writeByte(0x09);
this.blinkm.writeByte(0x09);
this.blinkm.writeByte(0x09)
}
*/
# This one works
Go to RGB Color Now n 0x6e 3 0 {‘n’,R,G,B}
# None of the rest of these seem to work
Fade to RGB Color c 0x63 3 0 {‘c’,R,G,B}
Fade to HSB Color h 0x68 3 0 {‘h’,H,S,B}
Fade to Random RGB Color C 0x43 3 0 {‘C’,R,G,B}
Fade to Random HSB Color H 0x48 3 0 {‘H’,H,S,B}
Play Light Script p 0x70 3 0 {‘p’,n,r,p}
Stop Script o 0x6f 0 0 {‘o’}
Set Fade Speed f 0x66 1 0 {‘f’,f}
Set Time Adjust t 0x74 1 0 {‘t’,t}
Get Current RGB Color g 0x67 0 3 {‘g’}
Write Script Line W 0x57 7 0 {‘W’,n,p,...}
Read Script Line R 0x52 2 5 {‘R’,n,p}
Set Script Length & Repeats L 0x4c 3 0 {‘L’,n,l,r}
Set BlinkM Address A 0x41 4 0 {‘A’,a...}
Get BlinkM Address a 0x61 0 1 {‘a’}
Get BlinkM Firmware Version Z 0x5a 0 1 {‘Z’}
Set Startup Parameters B 0x42 5 0 {‘B’,m,n,r,f,t}
//var Pins = require("pins");
import Pins from "pins";
var main = {
onLaunch(){
Pins.configure({
blinkm: {
require: "blinkm",
pins: {
blinkm: { sda: 15, clock: 16 },
ground: { pin: 13, type: "Ground" },
power: { pin: 14, type: "Power" }
}
},
}, (success) => {
if (success) {
Pins.invoke("/blinkm/sendcmd");
} else {
trace("Failed to configure\n");
}
});
}
};
export default main;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment