Created
September 8, 2015 08:34
-
-
Save jamwaffles/a8a64cd1fa6f5cf577cc to your computer and use it in GitHub Desktop.
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
SPI1.setup({ baud:3200000, mosi: A7 }); | |
var brightness = 0; | |
var delta = 1; | |
var maxBrightness = 250; | |
var numLeds = 12; | |
var data = new Uint8ClampedArray(numLeds * 3); | |
function sendFrame(data) { | |
SPI1.send4bit(data, 0b0001, 0b0011); | |
} | |
data.fill(0); | |
sendFrame(data); | |
pinMode(B4, "input_pulldown"); | |
setWatch(function() { | |
for(var i = 0; i < data.length; i++) { | |
data[i] = (0.5 * Math.random() / 2) * maxBrightness; | |
} | |
sendFrame(data); | |
}, B4, { repeat: true, debounce : 50, edge: "rising" }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment