Halloween in the BBB

by ibhatt

HTML

<meta name="description" content="Blinkenlights" />
<html>
  <script src="//code.jquery.com/jquery-latest.js"></script>
  <script src="//blinken.org/client.js"></script>
  <script src="//blinken.org/bulb.js"></script>
<body></body>
</html>

JavaScript

(new Blinken({title: "happy halloween", author: "some eecs girl"})).run(function(lights) {
    iter = 0;
    buffer = true;
	// Set the strand to full brightness
	for (i = 0; i < 100; i++) {
      lights[i].rgb(1, 0.647, 0);
      lights[i].a = 1;
      if (buffer){
        lights[i].rgb(0.48, 0.25, 0.52);
      }
      buffer = !buffer;
	}

	// Return our update function
	return function() {
// example sequence: on, give 500 wait, off, give 200 wait, on, give 200 wait, off, give 500 wait

        //if we waited 200 ms to distinguish between characters last time...
        // Loop over all the lights
        for (i = 0; i < 100; i++) {
          if (lights[i].r == 1){
            lights[i].rgb(0.48, 0.25, 0.52);
          }
          else {
            lights[i].rgb(1, 0.2, 0);
          }
        }
      iter++;
      return 500;
	};
});