#include #include #include #include /* For interaction with neopixels */ void setup() { init_serial_stdio(); init_neopixel_blit(); /* Clears (turns off) all neopixels and init */ } Pixels all_offs = {{0}}; /* Here instead of in loop() for efficiency */ /* loop() will unnecessarily initialize it to 0 */ /* every time. */ void loop() { int i; Pixels pix = {{0}}; /* If we don't set a color is already set to 0 due to {{0}} initialization */ pix[0][PIX_RED] = 10; /* Turn on neopixel with low intensity red */ pix[1][PIX_GRN] = 10; /* Turn on neopixel with low intensity green */ pix[2][PIX_BLU] = 10; /* Turn on neopixel with low intensity blue */ /* Setting the rest by alternating between two colors: yellow and purple */ for (i = 3; i < 10; i++) { if (i % 2) { pix[i][PIX_RED] = 10; pix[i][PIX_GRN] = 10; } else { pix[i][PIX_RED] = 10; pix[i][PIX_BLU] = 10; pix[i][PIX_GRN] = 10; } } neopixel_blit(pix); /* Set colors */ delay(2000); /* 2 seconds wait */ /* Clear neopixels */ neopixel_blit(all_offs); delay(2000); /* 2 seconds wait (what happens if you remove it?) */ }