Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 889 Bytes

README.md

File metadata and controls

20 lines (14 loc) · 889 Bytes

NeoPixel LED Simulator

Here's a little simulator to help sketch out LED animation functions for one of these things: https://www.adafruit.com/products/2875

Usage

The library includes some LED Modules (currently only NeoPixelRing60). These accept a callback to run on each render tick. The callback is passed an array of blank Pixel(r,g,b,w) instances, and the current tick. It must return an array of Pixels to be rendered.

You'll also need to instantiate a Simulator class. Simulator constructors take LED Modules as arguments. After you've instantiated your Simulator, call simulator.start() to begin the light show.

const neopixel = new NeoPixelRing60((pixels, t) => {
  return pixels.map(p => new Pixel(255, 255, 255, Math.random()))
})

const simulator = new Simulator(neopixel)
simulator.start()