/***************************************************************************** * * P0211 LED fading * This is for music symbol with fading rgb backlight * put this to a TNY85 with 8 MHz internal oscillator * Color changes slightly every 100ms, so one cycle is about 3 minutes * **************************************************************************** * * 2025-10-05 xsider created for C-Hack * ****************************************************************************/ #include #define NUMPIXELS 45 #define PIN 2 #define DELAY 100 Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); void setup() { pixels.begin(); } void loop() { uint8_t red; uint8_t green; uint8_t blue; /* this are the start values for every interation loop */ uint8_t settingstableRed[] = { 0xFF,0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, }; uint8_t settingstableGreen[] = { 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff } ; uint8_t settingstableBlue[] = { 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff }; /* which direction should the color fade to */ int8_t dirRed[] = {0,-1,0,0,1,0,0}; int8_t dirGreen[] = {1,0,0,-1,0,1,-1}; int8_t dirBlue[] = {0,0,1,0,0,0,-1}; for ( int k=0; k<7;k++) { for (int i=0;i<=255;i++) { red = settingstableRed[k] + dirRed[k]*i ; green = settingstableGreen[k] + dirGreen[k]*i; blue = settingstableBlue[k] + dirBlue[k]*i; for (int l=0;l