#include #define PIN 6 // Parametr 1 = počet pixelů (LED diod) na pásek // Parametr 2 = číslo PINu Arduina // Parametr 3 = pixel type flags, add together as needed: // NEO_KHZ800 800 KHz kmitočet pro pásky s WS2812 LED diodami) // NEO_GRB Pixely jsou zasílány ve formátu GRB Adafruit_NeoPixel pixels = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800); int delayval = 10; // 500ms void setup() { pixels.begin(); } void loop() { // První pixel na LED pásku má adresu "0", druhý pixel "1" atd. 1m pásku který má 60pixelů (LED diod) se adresuje 0-59 for(int i=0;i<60;i++){ pixels.setPixelColor(i, pixels.Color(20,0,0)); pixels.setPixelColor(i+1, pixels.Color(50,0,0)); pixels.setPixelColor(i+2, pixels.Color(100,0,0)); pixels.setPixelColor(i+3, pixels.Color(250,0,0)); pixels.setPixelColor(i+4, pixels.Color(100,0,0)); pixels.setPixelColor(i+5, pixels.Color(50,0,0)); pixels.setPixelColor(i+6, pixels.Color(20,0,0)); pixels.show(); delay(delayval); pixels.setPixelColor(i, pixels.Color(0,0,0)); } for(int i=59;i>0;i--){ pixels.setPixelColor(i, pixels.Color(20,0,0)); pixels.setPixelColor(i-1, pixels.Color(50,0,0)); pixels.setPixelColor(i-2, pixels.Color(100,0,0)); pixels.setPixelColor(i-3, pixels.Color(250,0,0)); pixels.setPixelColor(i-4, pixels.Color(100,0,0)); pixels.setPixelColor(i-5, pixels.Color(50,0,0)); pixels.setPixelColor(i-6, pixels.Color(20,0,0)); pixels.show(); delay(delayval); pixels.setPixelColor(i, pixels.Color(0,0,0)); } }