// RA: 23506 - Bárbara Brito
#include <Adafruit_NeoPixel.h>
#define NEOP_PIN 8
#define NUM_PIXELS 16
#define Delay 500
Adafruit_NeoPixel ring(
NUM_PIXELS,
NEOP_PIN,
NEO_GRB + NEO_KHZ800
);
#define red ring.Color(255, 0, 0)
#define purple ring.Color(128, 0, 128)
#define white ring.Color(255, 255, 255)
#define pink ring.Color(255, 192, 203)
#define preto ring.Color(0, 0, 0)
void setup() {
ring.begin();
ring.show();
}
void loop() {
for (int i = 0; i < NUM_PIXELS; i += 3) {
for (int j = 0; j < 3 && (i + j) < NUM_PIXELS; j++) {
uint32_t cor;
if ((i + j) % 4 == 0) {
cor = purple;
} else if ((i + j) % 4 == 1) {
cor = red;
} else if ((i + j) % 4 == 2) {
cor = white;
} else {
cor = pink;
}
ring.setPixelColor(i + j, cor);
}
ring.show();
delay(300);
}
for (int i = 0; i < NUM_PIXELS; i++) {
uint32_t cor;
if (i % 4 == 0) {
cor = purple;
} else if (i % 4 == 1) {
cor = red;
} else if (i % 4 == 2) {
cor = white;
} else {
cor = pink;
}
ring.setPixelColor(i, cor);
}
ring.show();
delay(1000);
for (int i = 0; i < NUM_PIXELS; i++) {
ring.setPixelColor(i, preto);
ring.show();
delay(100);
}
}