Skip to content

Instantly share code, notes, and snippets.

@focalintent
Last active April 15, 2016 19:41
Show Gist options
  • Save focalintent/7720f635cc05d62f8de3e355684d7425 to your computer and use it in GitHub Desktop.
Save focalintent/7720f635cc05d62f8de3e355684d7425 to your computer and use it in GitHub Desktop.
#include "FastLED.h"
template <EOrder RGB_ORDER=RGB>
class NetworkWriteController : public CPixelLEDController<RGB_ORDER> {
public:
public NetworkWriteController() {
// TODO: Modify the constructor to take other options that you might want/need (esp8266 ip
// address? etc...)
}
protected:
virtual void init() {
// do any one time setup here you might want for the controller
}
virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
while(pixels.has(1)) {
uint8_t r = pixels.loadAndScale0();
uint8_t g = pixels.loadAndScale1();
uint8_t b = pixels.loadAndScale2();
// TODO: Put your "write data out to the esp8266" code here
pixels.advanceData();
pixels.stepDithering();
}
}
};
CRGB leds[NUM_LEDS];
NetworkWriteController ledController;
void setup() {
// do the esp8266 setup/configuration
FastLED.addLeds(&ledController, leds, NUM_LEDS);
}
void loop() {
// blah blah blah animation code goes here
FastLED.show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment