/* WS2812Serial - Non-blocking WS2812 LED Display Library | |||||
https://github.com/PaulStoffregen/WS2812Serial | |||||
Copyright (c) 2017 Paul Stoffregen, PJRC.COM, LLC | |||||
Permission is hereby granted, free of charge, to any person obtaining a copy | |||||
of this software and associated documentation files (the "Software"), to deal | |||||
in the Software without restriction, including without limitation the rights | |||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||||
copies of the Software, and to permit persons to whom the Software is | |||||
furnished to do so, subject to the following conditions: | |||||
The above copyright notice and this permission notice shall be included in | |||||
all copies or substantial portions of the Software. | |||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |||||
THE SOFTWARE. | |||||
*/ | |||||
#include "WS2812Serial.h" | #include "WS2812Serial.h" | ||||
/* WS2812Serial - Non-blocking WS2812 LED Display Library | |||||
https://github.com/PaulStoffregen/WS2812Serial | |||||
Copyright (c) 2017 Paul Stoffregen, PJRC.COM, LLC | |||||
Permission is hereby granted, free of charge, to any person obtaining a copy | |||||
of this software and associated documentation files (the "Software"), to deal | |||||
in the Software without restriction, including without limitation the rights | |||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||||
copies of the Software, and to permit persons to whom the Software is | |||||
furnished to do so, subject to the following conditions: | |||||
The above copyright notice and this permission notice shall be included in | |||||
all copies or substantial portions of the Software. | |||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |||||
THE SOFTWARE. | |||||
*/ | |||||
#ifndef WS2812Serial_h_ | #ifndef WS2812Serial_h_ | ||||
#define WS2812Serial_h_ | #define WS2812Serial_h_ | ||||
/* WS2812Serial BasicTest Example | |||||
Test LEDs by turning then 7 different colors. | |||||
This example code is in the public domain. */ | |||||
#include <WS2812Serial.h> | #include <WS2812Serial.h> | ||||
const int numled = 64; | const int numled = 64; | ||||
// Teensy 3.5: 1, 5, 8, 10, 20, 26, 32, 33, 48 | // Teensy 3.5: 1, 5, 8, 10, 20, 26, 32, 33, 48 | ||||
// Teensy 3.6: 1, 5, 8, 10, 20, 26, 32, 33 | // Teensy 3.6: 1, 5, 8, 10, 20, 26, 32, 33 | ||||
byte drawingMemory[numled*3]; | |||||
DMAMEM byte displayMemory[numled*12]; | |||||
byte drawingMemory[numled*3]; // 3 bytes per LED | |||||
DMAMEM byte displayMemory[numled*12]; // 12 bytes per LED | |||||
WS2812Serial leds(numled, displayMemory, drawingMemory, pin, WS2812_GRB); | WS2812Serial leds(numled, displayMemory, drawingMemory, pin, WS2812_GRB); | ||||
WS2812Serial controls a single LED strip, using only 1 pin. While any number of | WS2812Serial controls a single LED strip, using only 1 pin. While any number of | ||||
LEDs may be connected, in practice 1 pin is best for small projects with less | LEDs may be connected, in practice 1 pin is best for small projects with less | ||||
than 500 to 1000 LEDs. OctoWS2811 offers 8 parallel outputs for large projects. | |||||
than 600 LEDs. OctoWS2811 offers 8 parallel outputs for large projects. | |||||
Non-blocking performance does come with a cost. 15 bytes of memory are required | Non-blocking performance does come with a cost. 15 bytes of memory are required | ||||
per LED, rather than the usual 3 bytes with [FastLED](http://fastled.io/) or | per LED, rather than the usual 3 bytes with [FastLED](http://fastled.io/) or |