#include <Adafruit_NeoPixel.h>

#define LED_PIN 2
#define LED_COUNT 60

Adafruit_NeoPixel pixels(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  pixels.begin();
}

void loop() {
  rainbowChaseClockwise(20, 50); // Change the values as per your preference
  rainbowChaseAnticlockwise(20, 50); // Change the values as per your preference
}

void rainbowChaseClockwise(int delayTime, int trailLength) {
  for (int j = 0; j < 256; j++) {
    for (int i = 0; i < pixels.numPixels() + trailLength; i++) {
      pixels.setPixelColor(i, Wheel(((i * 256 / pixels.numPixels()) + j) & 255));
      pixels.show();
      delay(delayTime);
      if (i >= trailLength) {
        pixels.setPixelColor(i - trailLength, 0);
      }
    }
  }
}

void rainbowChaseAnticlockwise(int delayTime, int trailLength) {
  for (int j = 0; j < 256; j++) {
    for (int i = pixels.numPixels() - 1; i >= -trailLength; i--) {
      int pixelIndex = i;
      if (i < 0) {
        pixelIndex = pixels.numPixels() + i; // Wrap around to the last pixel
      }
      pixels.setPixelColor(pixelIndex, Wheel(((pixelIndex * 256 / pixels.numPixels()) + j) & 255));
      pixels.show();
      delay(1000);
      if (i >= -trailLength) {
        int prevPixelIndex = i + trailLength;
        if (prevPixelIndex < 0) {
          prevPixelIndex = pixels.numPixels() + prevPixelIndex; // Wrap around to the last pixel
        }
        pixels.setPixelColor(prevPixelIndex, 0);
      }
    }
  }
}

uint32_t Wheel(byte WheelPos) {
  if (WheelPos < 85) {
    return pixels.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if (WheelPos < 170) {
    WheelPos -= 85;
    return pixels.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
    WheelPos -= 170;
    return pixels.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}
franzininho:12
franzininho:11
franzininho:10
franzininho:9
franzininho:8
franzininho:7
franzininho:6
franzininho:5
franzininho:4
franzininho:3
franzininho:2
franzininho:GND.2
franzininho:RESET.2
franzininho:0
franzininho:1
franzininho:13
franzininho:3.3V
franzininho:AREF
franzininho:A0
franzininho:A1
franzininho:A2
franzininho:A3
franzininho:A4
franzininho:A5
franzininho:A6
franzininho:A7
franzininho:5V
franzininho:RESET
franzininho:GND.1
franzininho:VIN
franzininho:12.2
franzininho:5V.2
franzininho:13.2
franzininho:11.2
franzininho:RESET.3
franzininho:GND.3
ring1:GND
ring1:VCC
ring1:DIN
ring1:DOUT