Casing PC Mini yang keren dan elegan menggunakan akrilik. Video ini saya ambil dari youtube tanpa mengurangi syarat dan ketentuan lisensi CC.

Alat dan Bahan

  • Desain Cutting Akrilik Format .CDR (CorelDraw 13) – Download
  • LED Lingkaran Kipas CPU
Arduino Nano Skema

Code Arduino untuk LED Lingkaran Kipas CPU:

#include <FastLED.h>
FASTLED_USING_NAMESPACE
#if defined(FASTLED_VERSION) && (FASTLED_VERSION < 3001000)
#warning "Requires FastLED 3.1 or later; check github for latest code."
#endif
#define DATA_PIN    6
#define LED_TYPE    WS2811
#define COLOR_ORDER GRB
#define NUM_LEDS    51
#define MAX_BRIGHTNESS 255           // Thats full on, watch the power!
#define MIN_BRIGHTNESS 10            // set to a minimum of 10%
const int brightnessInPin     = A4;
#define FRAMES_PER_SECOND  120
#define UPDATES_PER_SECOND 1000
CRGBArray<NUM_LEDS> leds;
CRGBPalette16 currentPalette;
CRGBPalette16 targetPalette;
TBlendType    currentBlending;
extern CRGBPalette16 myRedWhiteBluePalette;
extern const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM;
CRGBPalette16 thisPalette;
CRGBPalette16 thatPalette;
#define qsubd(x, b)  ((x>b)?b:0)
#define qsuba(x, b)  ((x>b)?x-b:0)
unsigned long previousMillis;
uint8_t thishue;
uint8_t thathue;
uint8_t thisrot;
uint8_t thatrot;
uint8_t allsat;
uint8_t thisdir;
uint8_t thatdir;
uint8_t alldir;
int8_t thisspeed;
int8_t thatspeed;
uint8_t allfreq;
int thisphase;
int thatphase;
uint8_t thiscutoff;
uint8_t thatcutoff;
int thisdelay;
uint8_t fadeval;
int wave1 = 0;
int wave2 = 0;
int wave3 = 0;
uint8_t lvl1 = 80;
uint8_t lvl2 = 80;
uint8_t lvl3 = 80;
uint8_t mul1 = 7;
uint8_t mul2 = 6;
uint8_t mul3 = 5;
uint8_t thishue2 = 0;
int8_t thisrot2 = 1;
uint8_t deltahue2 = 1;
bool thisdir2 = 0;

void setup() {
  delay(5000); // 3 second delay for recovery
  FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
  currentPalette = RainbowColors_p;
  currentBlending = LINEARBLEND;
}
typedef void (*SimplePatternList[])();
SimplePatternList gPatterns = {
  sinelon,
  juggle2,
  juggle3,
  juggle5,
  juggle7,
  doublerun,
  bpm,
  confetti,
  matrixray,
  rainbow,
  rainbowWithGlitter,
  rainbowmarch, rainbowmarch,
  palette, palette, palette, palette, palette, palette,
  threesinpal, threesinpal, threesinpal, threesinpal,
};
uint8_t gCurrentPatternNumber = 0;
uint8_t gHue = 0;
void loop() {
  int mappedValue = map(analogRead(brightnessInPin), 0, 1023, 0, 255);
  FastLED.setBrightness(constrain(mappedValue, MIN_BRIGHTNESS, MAX_BRIGHTNESS));
  gPatterns[gCurrentPatternNumber]();
  FastLED.show();
  FastLED.delay(1000 / FRAMES_PER_SECOND);
  EVERY_N_MILLISECONDS( 10 ) {
    gHue++;  // slowly cycle the "base color" through the rainbow
  }
  EVERY_N_SECONDS( 20 ) {
    nextPattern();  // change patterns periodically
  }
}
#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))
void nextPattern() {
  gCurrentPatternNumber = (gCurrentPatternNumber + 1) % ARRAY_SIZE( gPatterns);
}
void rainbow() {
  fill_rainbow( leds, NUM_LEDS, gHue, 20);
}
void rainbowWithGlitter() {
  rainbow();
  addGlitter(100);
}
void addGlitter( fract8 chanceOfGlitter) {
  if ( random8() < chanceOfGlitter) {
    leds[ random16(NUM_LEDS) ] += CRGB::White;
  }
}
void confetti() {
  fadeToBlackBy( leds, NUM_LEDS, 10);
  int pos = random16(NUM_LEDS);
  leds[pos] += CHSV( gHue + random8(255), 255, 255);
}
void sinelon() {
  fadeToBlackBy( leds, NUM_LEDS, 10);
  int pos = beatsin16( 20, 0, NUM_LEDS - 1 );
  leds[pos] += CHSV( gHue, 255, 192);
}
void juggle2() {
  fadeToBlackBy( leds, NUM_LEDS, 10);
  byte dothue = 0;
  for ( int i = 0; i < 2; i++) { //how many led to animation
    leds[beatsin16( i + 15, 0, NUM_LEDS - 1 )] |= CHSV(dothue, 255, 255); //i+10 = speed
    dothue += 100;
  }
}
void juggle3() {
  fadeToBlackBy( leds, NUM_LEDS, 15); //long and shot
  byte dothue = 0;
  for ( int i = 0; i < 3; i++) { //how many led to animation
    leds[beatsin16( i + 15, 0, NUM_LEDS - 1 )] |= CHSV(dothue, 255, 255); //i+10 = speed
    dothue += 100;;
  }
}
void juggle5() {
  fadeToBlackBy( leds, NUM_LEDS, 20); //long and shot
  byte dothue = 0;
  for ( int i = 0; i < 5; i++) { //how many led to animation
    leds[beatsin16( i + 15, 0, NUM_LEDS - 1 )] |= CHSV(dothue, 255, 255); //i+10 = speed
    dothue += 100;
  }
}
void juggle7() {
  fadeToBlackBy( leds, NUM_LEDS, 25); //long and shot
  byte dothue = 0;
  for ( int i = 0; i < 7; i++) { //how many led to animation
    leds[beatsin16( i + 15, 0, NUM_LEDS - 1 )] |= CHSV(dothue, 255, 255); //i+10 = speed
    dothue += 100;
  }
}
void bpm() {
  uint8_t BeatsPerMinute = 65;
  CRGBPalette16 palette = RainbowColors_p;
  uint8_t beat = beatsin8( BeatsPerMinute, 64, 255);
  for ( int i = 0; i < NUM_LEDS; i++) { //9948
    leds[i] = ColorFromPalette(palette, gHue + (i * 2), beat - gHue + (i * 15));
  }
}
void doublerun() {
  static uint8_t hue;
  for (int i = 0; i < NUM_LEDS / 1; i++) {
    fadeToBlackBy( leds, NUM_LEDS, 50);
    leds[i] = CHSV(hue++, 255, 255);
    leds(NUM_LEDS / 2, NUM_LEDS - 1) = leds(NUM_LEDS / 2 - 2 , 0);
    FastLED.delay(20);//speed
  }
}

void rainbowmarch () {
  ChangeeMe();
  EVERY_N_MILLISECONDS(10) {  //speed
    rainbow_march();
  }
  FastLED.show();
}
void rainbow_march() {
  if (thisdir2 == 0) thishue2 += thisrot2; else thishue2 -= thisrot2;
  fill_rainbow(leds, NUM_LEDS, thishue2, deltahue2);
}
void ChangeeMe() {
  uint8_t secondHand = (millis() / 2000) % 30;
  static uint8_t lastSecond = 99;
  if (lastSecond != secondHand) {
    lastSecond = secondHand;
    switch (secondHand) {
      case  0: thisrot2 = 1; deltahue2 = 5; break;
      case  5: thisdir2 = -1; deltahue2 = 10; break;
      case 10: thisrot2 = 5; break;
      case 15: thisrot2 = 5; thisdir2 = -1; deltahue2 = 20; break;
      case 20: deltahue2 = 30; break;
      case 25: deltahue2 = 2; thisrot2 = 5; break;
      case 30: break;
    }
  }
}

void threesinpal () {
  ChangeMee();
  uint8_t maxChanges = 24;
  EVERY_N_MILLISECONDS(20) {    //speed
    nblendPaletteTowardPalette( currentPalette, targetPalette, maxChanges);
    three_sin();
  }
  FastLED.show();
}
void three_sin() {
  wave1 += beatsin8(10, -4, 4);
  wave2 += beatsin8(15, -2, 2);
  wave3 += beatsin8(12, -3, 3);
  for (int k = 0; k < NUM_LEDS; k++) {
    uint8_t tmp = sin8(mul1 * k + wave1) + sin8(mul1 * k + wave2) + sin8(mul1 * k + wave3);
    leds[k] = ColorFromPalette(currentPalette, tmp, 255);
  }
}
void ChangeMee() {
  uint8_t secondHand = (millis() / 1000) % 40;
  static uint8_t lastSecond = 99;
  if ( lastSecond != secondHand) {
    lastSecond = secondHand;
    CRGB p = CHSV( HUE_PURPLE, 255, 255);
    CRGB g = CHSV( HUE_GREEN, 255, 255);
    CRGB u = CHSV( HUE_BLUE, 255, 255);
    CRGB b = CRGB::Black;
    CRGB w = CRGB::White;
    switch (secondHand) {
      case  0: targetPalette = RainbowColors_p; break;
      case  5: targetPalette = CRGBPalette16( u, u, b, b, p, p, b, b, u, u, b, b, p, p, b, b); break;
      case 10: targetPalette = LavaColors_p; break;
      case 15: targetPalette = ForestColors_p; break;
      case 20: targetPalette = PartyColors_p; break;
      case 25: targetPalette = CRGBPalette16( b, b, b, w, b, b, b, w, b, b, b, w, b, b, b, w); break;
      case 30: targetPalette = CRGBPalette16( u, u, u, w, u, u, u, w, u, u, u, w, u, u, u, w); break;
      case 35: targetPalette = CRGBPalette16( u, p, u, w, p, u, u, w, u, g, u, w, u, p, u, w); break;
      case 40: break;
    }
  }
}

void matrixray () {
  EVERY_N_MILLIS_I(thisTimer, 100) {
    uint8_t timeval = beatsin8(10, 20, 50);
    thisTimer.setPeriod(timeval);
    matrix_ray(millis() >> 1);
  }
  EVERY_N_MILLISECONDS(100) {
    uint8_t maxChanges = 24;
    nblendPaletteTowardPalette(currentPalette, targetPalette, maxChanges);
  }
  EVERY_N_SECONDS(5) {
    static uint8_t baseC = random8();
    targetPalette = CRGBPalette16(
                      CHSV(random8(), 255, random8(128, 255)),
                      CHSV(random8(), 255, random8(128, 255)),
                      CHSV(random8(), 192, random8(128, 255)),
                      CHSV(random8(), 255, random8(128, 255)));
  }
  FastLED.show();
  Serial.println(LEDS.getFPS());
}
void matrix_ray(uint8_t colorIndex) {
  static uint8_t thisdir = 0;
  static int thisphase = 0;
  uint8_t thiscutoff;
  thisphase += beatsin8(1, 20, 50);
  thiscutoff = beatsin8(50, 164, 248);
  int thisbright = qsubd(cubicwave8(thisphase), thiscutoff);
  if (thisdir == 0) {
    leds[0] = ColorFromPalette(currentPalette, colorIndex, thisbright, currentBlending);
    memmove(leds + 1, leds, (NUM_LEDS - 1) * 3);
  } else {
    leds[NUM_LEDS - 1] = ColorFromPalette( currentPalette, colorIndex, thisbright, currentBlending);
    memmove(leds, leds + 1, (NUM_LEDS - 1) * 3);
  }
}

void palette() {
  ChangePalettePeriodically();
  static uint8_t startIndex = 0;
  startIndex = startIndex + 1; // motion speed
  FillLEDsFromPaletteColors( startIndex);
  FastLED.show();
  FastLED.delay(1000 / UPDATES_PER_SECOND);
}
void FillLEDsFromPaletteColors( uint8_t colorIndex) {
  uint8_t brightness = 255;
  for ( int i = 0; i < NUM_LEDS; i++) {
    leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
    colorIndex += 3;
  }
}
void ChangePalettePeriodically() {
  uint8_t secondHand = (millis() / 3000) % 35; //speed Change Palette =1000
  static uint8_t lastSecond = 99;
  if ( lastSecond != secondHand) {
    lastSecond = secondHand;
    if ( secondHand == 0)   {
      currentPalette = RainbowColors_p;
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 5)   {
      currentPalette = RainbowStripeColors_p;
      currentBlending = NOBLEND;
    }
    if ( secondHand == 10)  {
      currentPalette = myRedWhiteBluePalette_p;
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 15)  {
      currentPalette = OceanColors_p;
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 20)  {
      currentPalette = ForestColors_p;
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 25)  {
      currentPalette = CloudColors_p;
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 30)  {
      currentPalette = LavaColors_p;
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 35)  {
      currentPalette = PartyColors_p;
      currentBlending = LINEARBLEND;
    }
  }
}
void SetupTotallyRandomPalette()
{
  for ( int i = 0; i < 16; i++) {
    currentPalette[i] = CHSV( random8(), 255, random8());
  }
}
const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM =
{
  CRGB::Red,
  CRGB::Gray,
  CRGB::Blue,
  CRGB::Black,
  CRGB::Red,
  CRGB::Gray,
  CRGB::Blue,
  CRGB::Black,
  CRGB::Red,
  CRGB::Red,
  CRGB::Gray,
  CRGB::Gray,
  CRGB::Blue,
  CRGB::Blue,
  CRGB::Black,
  CRGB::Black
};
  • LED Logo Font & Infinity Mirror
Arduino Nano Skema

Code Arduino Logo Font:

#include <FastLED.h>
FASTLED_USING_NAMESPACE
#if defined(FASTLED_VERSION) && (FASTLED_VERSION < 3001000)
#warning "Requires FastLED 3.1 or later; check github for latest code."
#endif
#define DATA_PIN    6
#define LED_TYPE    WS2811
#define COLOR_ORDER GRB
#define NUM_LEDS    60
#define BRIGHTNESS          255
#define FRAMES_PER_SECOND  120
#define UPDATES_PER_SECOND 300
//#define MAX_BRIGHTNESS 255          // Thats full on, watch the power!
//#define MIN_BRIGHTNESS 0            // set to a minimum of 10%
//const int brightnessInPin     = A5;
//CRGB leds[NUM_LEDS];
CRGBArray<NUM_LEDS> leds;
CRGBPalette16 currentPalette;
CRGBPalette16 targetPalette;
TBlendType    currentBlending;
extern CRGBPalette16 myRedWhiteBluePalette;
extern const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM;
CRGBPalette16 thisPalette;
CRGBPalette16 thatPalette;

void setup() {
  delay(5000); // 3 second delay for recovery
  FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
  FastLED.setBrightness(BRIGHTNESS);
  currentPalette = RainbowColors_p;
  currentBlending = LINEARBLEND;
}

typedef void (*SimplePatternList[])();
SimplePatternList gPatterns = {
  rainbow,
  palette, palette, palette, palette, palette, palette
};

uint8_t gCurrentPatternNumber = 0; // Index number of which pattern is current
uint8_t gHue = 0; // rotating "base color" used by many of the patterns

void loop() {
  //int mappedValue = map(analogRead(brightnessInPin), 0, 1023, 0, 255);
  //FastLED.setBrightness(constrain(mappedValue, MIN_BRIGHTNESS, MAX_BRIGHTNESS));
  gPatterns[gCurrentPatternNumber]();
  FastLED.show();
  FastLED.delay(1000 / FRAMES_PER_SECOND);
  EVERY_N_MILLISECONDS( 20 ) {
    gHue++;
  }
  EVERY_N_SECONDS( 60 ) {
    nextPattern();  // change patterns periodically
  }
}
#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))
void nextPattern() {
  gCurrentPatternNumber = (gCurrentPatternNumber + 1) % ARRAY_SIZE( gPatterns);
}

void rainbow() {
  //FastLED's built-in rainbow generator
  fill_rainbow( leds, NUM_LEDS, gHue, 18);
}

void palette() {
  ChangePalettePeriodically();
  static uint8_t startIndex = 0;
  startIndex = startIndex - 1; // motion speed
  FillLEDsFromPaletteColors( startIndex);
  //leds(NUM_LEDS/2,NUM_LEDS-1) = leds(NUM_LEDS/2 - 2 ,0);//double
  FastLED.show();
  FastLED.delay(3500 / UPDATES_PER_SECOND);
}
void FillLEDsFromPaletteColors( uint8_t colorIndex) {
  uint8_t brightness = 255;
  for ( int i = 0; i < NUM_LEDS; i++) {
    leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
    colorIndex += 5;
  }
}
void ChangePalettePeriodically()
{
  uint8_t secondHand = (millis() / 7500) % 50;
  static uint8_t lastSecond = 99;
  if ( lastSecond != secondHand) {
    lastSecond = secondHand;
    if ( secondHand == 0)   {
      currentPalette = RainbowColors_p;
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 10)  {
      currentPalette = myRedWhiteBluePalette_p;
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 15)  {
      SetupPurpleAndGreenPalette();
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 20)  {
      RedPalette();
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 25)  {
      WhitePalette();
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 30)  {
      currentPalette = CloudColors_p;
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 35)  {
      currentPalette = ForestColors_p;
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 40)  {
      currentPalette = LavaColors_p;
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 45)  {
      currentPalette = PartyColors_p;
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 50)  {
      SetupTotallyRandomPalette();
      currentBlending = LINEARBLEND;
    }
  }
}
void SetupTotallyRandomPalette()
{
  for ( int i = 0; i < 16; i++) {
    currentPalette[i] = CHSV( random8(), 255, random8());
  }
}
void RedPalette()
{
  fill_solid( currentPalette, 16, CRGB::Red);
  currentPalette[0] = CRGB::Red;
  currentPalette[2] = CRGB::White;
  currentPalette[4] = CRGB::Red;
  currentPalette[6] = CRGB::Blue;
  currentPalette[8] = CRGB::Red;
  currentPalette[12] = CRGB::Yellow;
}
void WhitePalette()
{
  fill_solid( currentPalette, 16, CRGB::White);
  currentPalette[0] = CRGB::White;
  currentPalette[4] = CRGB::White;
  currentPalette[8] = CRGB::White;
  currentPalette[12] = CRGB::Red;
}
void PurplePalette()
{
  fill_solid( currentPalette, 16, CRGB::Purple);
  currentPalette[0] = CRGB::Purple;
  currentPalette[2] = CRGB::Blue;
  currentPalette[4] = CRGB::Purple;
  currentPalette[6] = CRGB::Red;
  currentPalette[8] = CRGB::Purple;
  currentPalette[12] = CRGB::Green;
}
void GreenPalette()
{
  fill_solid( currentPalette, 16, CRGB::Green);
  currentPalette[0] = CRGB::Green;
  currentPalette[2] = CRGB::White;
  currentPalette[4] = CRGB::Green;
  currentPalette[6] = CRGB::Red;
  currentPalette[8] = CRGB::Green;
  currentPalette[12] = CRGB::Purple;
}
void SetupPurpleAndGreenPalette()
{
  CRGB purple = CHSV( HUE_PURPLE, 255, 255);
  CRGB green  = CHSV( HUE_GREEN, 255, 255);
  CRGB black  = CRGB::Black;
  currentPalette = CRGBPalette16(
                     green,  green,  green,  green,
                     purple, purple, purple,  purple,
                     green,  green,  green,  green,
                     purple, purple, purple,  purple );
}
const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM =
{
  CRGB::Red,
  CRGB::Gray,
  CRGB::Blue,
  CRGB::Black,

  CRGB::Red,
  CRGB::Gray,
  CRGB::Blue,
  CRGB::Black,

  CRGB::Red,
  CRGB::Red,
  CRGB::Gray,
  CRGB::Gray,
  CRGB::Blue,
  CRGB::Blue,
  CRGB::Black,
  CRGB::Black
};

Code Arduino Infinity Mirror:

#include <FastLED.h>
FASTLED_USING_NAMESPACE
#if defined(FASTLED_VERSION) && (FASTLED_VERSION < 3001000)
#warning "Requires FastLED 3.1 or later; check github for latest code."
#endif
#define DATA_PIN    6
#define LED_TYPE    WS2811
#define COLOR_ORDER GRB
#define NUM_LEDS    110
#define BRIGHTNESS          200
#define FRAMES_PER_SECOND  120
#define UPDATES_PER_SECOND 1000
#define qsubd(x, b)  ((x>b)?b:0)
#define qsuba(x, b)  ((x>b)?x-b:0)
//#define MAX_BRIGHTNESS 255          // Thats full on, watch the power!
//#define MIN_BRIGHTNESS 0            // set to a minimum of 10%
//const int brightnessInPin     = A5;
int blue[3]    = {0,  0, 255};
int red[3]     = {255,  0, 0};
int green[3]   = {0,  255, 0};
int purple[3]  = {200,  0, 200};
int yellow[3]  = {200,  200, 0};
int skyblue[3] = {0,  200, 200};
int white[3]   = {150,  150, 150};
int i;
void fade_between(int a[3], int b[3], CRGB leds[NUM_LEDS], int del);
void set_definite(int a[3], CRGB leds[NUM_LEDS]);
//CRGB leds[NUM_LEDS];
CRGBArray<NUM_LEDS> leds;
CRGBPalette16 currentPalette;
CRGBPalette16 targetPalette;
TBlendType    currentBlending;
extern CRGBPalette16 myRedWhiteBluePalette;
extern const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM;
CRGBPalette16 thisPalette;
CRGBPalette16 thatPalette;
unsigned long previousMillis;
uint8_t thishue;
uint8_t thathue;
uint8_t thisrot;
uint8_t thatrot;
uint8_t allsat;
uint8_t thisdir;
uint8_t thatdir;
uint8_t alldir;
int8_t thisspeed;
int8_t thatspeed;
uint8_t allfreq;
int thisphase;
int thatphase;
uint8_t thiscutoff;
uint8_t thatcutoff;
int thisdelay;
uint8_t fadeval;
int wave1 = 0;
int wave2 = 0;
int wave3 = 0;
uint8_t lvl1 = 80;
uint8_t lvl2 = 80;
uint8_t lvl3 = 80;
uint8_t mul1 = 7;
uint8_t mul2 = 6;
uint8_t mul3 = 5;
int      thisdelay1 =  50;
uint8_t    palIndex1 =  95;
uint8_t    thissat1 = 255;
int        thisdir1 =   0;
uint8_t thisbright1 = 255;
bool        huerot1 =   0;
uint8_t      bgclr1 =   0;
uint8_t      bgbri1 =   0;

void setup() {
  delay(5000); // 3 second delay for recovery
  FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
  FastLED.setBrightness(BRIGHTNESS);
  currentPalette = RainbowColors_p;
  currentBlending = LINEARBLEND;
}

typedef void (*SimplePatternList[])();
SimplePatternList gPatterns = {
  rainbow,
  EverChangingRainbow, EverChangingRainbow,
  mover, mover,
  palettecrossfadeMatrix, palettecrossfadeMatrix,
  threesinpal, threesinpal, threesinpal,
  matrixpal,
  palette, palette, palette, palette,
  fadeled
};

uint8_t gCurrentPatternNumber = 0; // Index number of which pattern is current
uint8_t gHue = 0; // rotating "base color" used by many of the patterns

void loop() {
  //int mappedValue = map(analogRead(brightnessInPin), 0, 1023, 0, 255);
  //FastLED.setBrightness(constrain(mappedValue, MIN_BRIGHTNESS, MAX_BRIGHTNESS));
  gPatterns[gCurrentPatternNumber]();
  FastLED.show();
  FastLED.delay(1000 / FRAMES_PER_SECOND);
  EVERY_N_MILLISECONDS( 20 ) {
    gHue++;
  }
  EVERY_N_SECONDS( 60 ) {
    nextPattern();  // change patterns periodically
  }
}
#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))
void nextPattern() {
  gCurrentPatternNumber = (gCurrentPatternNumber + 1) % ARRAY_SIZE( gPatterns);
}

void rainbow() {
  //FastLED's built-in rainbow generator
  fill_rainbow( leds, NUM_LEDS, gHue, 7);
}

void fadeled() {
  fade_between(white, blue, leds, 80); //10=fast , 200=slow
  delay(1000);
  fade_between(blue, skyblue, leds, 80);
  delay(1000);
  fade_between(skyblue, green, leds, 80);
  delay(1000);
  fade_between(green, yellow, leds, 80);
  delay(1000);
  fade_between(yellow, red, leds, 80);
  delay(1000);
  fade_between(red, purple, leds, 80);
  delay(1000);
  fade_between(purple, white, leds, 80);
  delay(1000);
}
void fade_between(int a[3], int b[3], CRGB leds[NUM_LEDS], int del) {
  int i, j, steps = 100;
  double dsteps = 100.0;
  double s1, s2, s3, tmp1, tmp2, tmp3;
  s1 = double((b[0] - a[0])) / dsteps;
  s2 = double((b[1] - a[1])) / dsteps;
  s3 = double((b[2] - a[2])) / dsteps;
  tmp1 = a[0], tmp2 = a[1], tmp3 = a[2];
  for (i = 0; i < steps; i++) {
    tmp1 += s1;
    tmp2 += s2;
    tmp3 += s3;
    for (j = 0; j < NUM_LEDS; j++)
      leds[j] = CRGB((int)round(tmp1), (int)round(tmp2), (int)round(tmp3));
    FastLED.show();
    delay(del);
  }
  set_definite(b, leds);
}
void set_definite(int a[3], CRGB leds[NUM_LEDS]) {
  int i;
  for (i = 0; i < NUM_LEDS; i++)
    leds[i] = CRGB(a[0], a[1], a[2]);
  FastLED.show();
}

void mover() {
  EVERY_N_MILLISECONDS(100) {
    uint8_t maxChanges = 24;
    nblendPaletteTowardPalette(currentPalette, targetPalette, maxChanges);
  }
  EVERY_N_SECONDS(20) {
    static uint8_t baseC = random8();
    targetPalette = CRGBPalette16(
                      CHSV(random8(), 255, random8(128, 255)),
                      CHSV(random8(), 255, random8(128, 255)),
                      CHSV(random8(), 255, random8(128, 255)),
                      CHSV(random8(), 255, random8(128, 255)));
  }
  animationA();
  FastLED.show();
}
void animationA() {
  for (int i = 0; i < NUM_LEDS; i++) {
    uint8_t red = (millis() / 3.0) + (i * 25);   // speed, length
    if (red > 255) red = 0;
    leds[i] = ColorFromPalette(currentPalette, red, red, currentBlending);
  }
}

void EverChangingRainbow() {
  EVERY_N_MILLISECONDS(1) {     //speed
    pride();
    FastLED.show();
  }
}
void pride()
{
  static uint16_t sPseudotime = 0;
  static uint16_t sLastMillis = 0;
  static uint16_t sHue16 = 0;
  uint8_t sat8 = beatsin88( 87, 220, 255);
  uint8_t brightdepth = beatsin88( 341, 96, 224);
  uint16_t brightnessthetainc16 = beatsin88( 203, (25 * 256), (40 * 256));
  uint8_t msmultiplier = beatsin88(147, 23, 60);
  uint16_t hue16 = sHue16;//gHue * 256;
  uint16_t hueinc16 = beatsin88(113, 1, 3000); //rainbow circle
  uint16_t ms = millis();
  uint16_t deltams = ms - sLastMillis ;
  sLastMillis  = ms;
  sPseudotime += deltams * msmultiplier;
  sHue16 += deltams * beatsin88( 400, 5, 9);
  uint16_t brightnesstheta16 = sPseudotime;
  for ( uint16_t i = 0 ; i < NUM_LEDS; i++) {
    hue16 += hueinc16;
    uint8_t hue8 = hue16 / 256;
    brightnesstheta16  += brightnessthetainc16;
    uint16_t b16 = sin16( brightnesstheta16  ) + 32768;
    uint16_t bri16 = (uint32_t)((uint32_t)b16 * (uint32_t)b16) / 65536;
    uint8_t bri8 = (uint32_t)(((uint32_t)bri16) * brightdepth) / 65536;
    bri8 += (255 - brightdepth);
    CRGB newcolor = CHSV( hue8, sat8, bri8);
    uint16_t pixelnumber = i;
    pixelnumber = (NUM_LEDS - 1) - pixelnumber;
    nblend( leds[pixelnumber], newcolor, 64);
  }
}

void palettecrossfadeMatrix() {
  ChangePalette();
  EVERY_N_MILLISECONDS(100) {
    uint8_t maxChanges = 24;
    nblendPaletteTowardPalette(currentPalette, targetPalette, maxChanges);
  }
  EVERY_N_MILLISECONDS(1) { //speed
    static uint8_t startIndex = 0;
    startIndex += 1;    // motion speed
    FillLEDsFromPalette(startIndex);
  }
  FastLED.show();
}
void FillLEDsFromPalette(uint8_t colorIndex) {
  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i] = ColorFromPalette(currentPalette, colorIndex + sin8(i * 16), 255);
    colorIndex += 3;
  }
}
void ChangePalette() {
  uint8_t secondHand = (millis() / 1000) % 60;
  static uint8_t lastSecond = 99;
  if (lastSecond != secondHand) {
    lastSecond = secondHand;
    CRGB p = CHSV(HUE_PURPLE, 255, 255);
    CRGB g = CHSV(HUE_GREEN, 255, 255);
    CRGB b = CRGB::Black;
    CRGB w = CRGB::White;
    if (secondHand ==  0)  {
      targetPalette = RainbowColors_p;
    }
    if (secondHand == 10)  {
      targetPalette = CRGBPalette16(g, g, b, b, p, p, b, b, g, g, b, b, p, p, b, b);
    }
    if (secondHand == 20)  {
      targetPalette = CRGBPalette16(b, b, b, w, b, b, b, w, b, b, b, w, b, b, b, w);
    }
    if (secondHand == 30)  {
      targetPalette = LavaColors_p;
    }
    if (secondHand == 40)  {
      targetPalette = CloudColors_p;
    }
    if (secondHand == 50)  {
      targetPalette = PartyColors_p;
    }
  }
}

void threesinpal () {
  ChangeMee();
  uint8_t maxChanges = 24;
  EVERY_N_MILLISECONDS(20) {    //speed
    nblendPaletteTowardPalette( currentPalette, targetPalette, maxChanges);
    three_sin();                                              // Improved method of using non-blocking delay
  }
  FastLED.show();
}
void three_sin() {
  wave1 += beatsin8(10, -4, 4);
  wave2 += beatsin8(15, -2, 2);
  wave3 += beatsin8(12, -3, 3);
  for (int k = 0; k < NUM_LEDS; k++) {
    uint8_t tmp = sin8(mul1 * k + wave1) + sin8(mul1 * k + wave2) + sin8(mul1 * k + wave3);
    leds[k] = ColorFromPalette(currentPalette, tmp, 255);
  }
}
void ChangeMee() {
  uint8_t secondHand = (millis() / 1000) % 60;
  static uint8_t lastSecond = 99;
  if ( lastSecond != secondHand) {
    lastSecond = secondHand;
    CRGB p = CHSV( HUE_PURPLE, 255, 255);
    CRGB g = CHSV( HUE_GREEN, 255, 255);
    CRGB u = CHSV( HUE_BLUE, 255, 255);
    CRGB b = CRGB::Black;
    CRGB w = CRGB::White;
    switch (secondHand) {
      case  0: targetPalette = RainbowColors_p; break;
      case  5: targetPalette = CRGBPalette16( u, u, b, b, p, p, b, b, u, u, b, b, p, p, b, b); break;
      case 10: targetPalette = OceanColors_p; break;
      case 15: targetPalette = CloudColors_p; break;
      case 20: targetPalette = LavaColors_p; break;
      case 25: targetPalette = ForestColors_p; break;
      case 30: targetPalette = PartyColors_p; break;
      case 35: targetPalette = CRGBPalette16( b, b, b, w, b, b, b, w, b, b, b, w, b, b, b, w); break;
      case 40: targetPalette = CRGBPalette16( u, u, u, w, u, u, u, w, u, u, u, w, u, u, u, w); break;
      case 45: targetPalette = CRGBPalette16( u, p, u, w, p, u, u, w, u, g, u, w, u, p, u, w); break;
      case 50: targetPalette = CloudColors_p; break;
      case 55: targetPalette = CRGBPalette16( u, u, u, w, u, u, p, p, u, p, p, p, u, p, p, w); break;
      case 60: break;
    }
  }
}

void matrixpal () {
  ChangMe();
  EVERY_N_MILLISECONDS(100) {
    uint8_t maxChanges = 24;
    nblendPaletteTowardPalette(currentPalette, targetPalette, maxChanges);   // AWESOME palette blending capability.
  }
  EVERY_N_MILLISECONDS(10) { //speed
    matrix();
  }
  FastLED.show();
}
void matrix() {
  if (huerot1) palIndex1++;
  if (random8(90) > 80) { //longs & shorts =80
    if (thisdir == 0)
      leds[0] = ColorFromPalette(currentPalette, palIndex1, thisbright1, currentBlending);
    else
      leds[NUM_LEDS - 1] = ColorFromPalette( currentPalette, palIndex1, thisbright1, currentBlending);
  } else {
    if (thisdir == 0)
      leds[0] = CHSV(bgclr1, thissat1, bgbri1);
    else
      leds[NUM_LEDS - 1] = CHSV(bgclr1, thissat1, bgbri1);
  }
  if (thisdir == 0) {
    for (int i = NUM_LEDS - 1; i > 0 ; i-- ) leds[i] = leds[i - 1];
  } else {
    for (int i = 0; i < NUM_LEDS - 1 ; i++ ) leds[i] = leds[i + 1];
  }
}
void ChangMe() {
  uint8_t secondHand = (millis() / 1000) % 50; // speed Change Palette =2000
  static uint8_t lastSecond = 99;              // Static variable, means it's only defined once. This is our 'debounce' variable.
  if (lastSecond != secondHand) {              // Debounce to make sure we're not repeating an assignment.
    lastSecond = secondHand;
    switch (secondHand) {
      case  0: thisdelay1 = 20; palIndex1 = 195; bgclr1 = 140; bgbri1 = 100; huerot1 = 0; break; //20=speed
      case  5: targetPalette = PartyColors_p; thisdir1 = 10; bgbri1 = 10; huerot1 = 10; break;
      case 10: targetPalette = ForestColors_p; thisdelay1 = 80; bgbri1 = 16; bgclr1 = 96; palIndex1 = random8(); break;
      case 15: targetPalette = RainbowColors_p; thisdelay1 = 80; bgbri1 = 16; bgclr1 = 96; palIndex1 = random8(); break;
      case 20: targetPalette = LavaColors_p; thisdelay1 = 80; bgbri1 = 16; bgclr1 = 96; palIndex1 = random8(); break;
      case 25: targetPalette = CloudColors_p; thisdelay1 = 80; bgbri1 = 16; bgclr1 = 96; palIndex1 = random8(); break;
      case 30: targetPalette = OceanColors_p; thisdelay1 = 80; bgbri1 = 16; bgclr1 = 96; palIndex1 = random8(); break;
      case 35: palIndex1 = random8(); huerot1 = 1; break;
      case 40: break;
    }
  }
}

void palette() {
  ChangePalettePeriodically();
  static uint8_t startIndex = 0;
  startIndex = startIndex + 1; // motion speed
  FillLEDsFromPaletteColors( startIndex);
  //leds(NUM_LEDS/2,NUM_LEDS-1) = leds(NUM_LEDS/2 - 2 ,0);//double
  FastLED.show();
  FastLED.delay(1000 / UPDATES_PER_SECOND);
}
void FillLEDsFromPaletteColors( uint8_t colorIndex) {
  uint8_t brightness = 255;
  for ( int i = 0; i < NUM_LEDS; i++) {
    leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
    colorIndex += 3;
  }
}
void ChangePalettePeriodically() {
  uint8_t secondHand = (millis() / 5000) % 40; //speed Change Palette =1000
  static uint8_t lastSecond = 99;
  if ( lastSecond != secondHand) {
    lastSecond = secondHand;
    if ( secondHand == 0)   {
      SetupTotallyRandomPalette();
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 10)  {
      currentPalette = LavaColors_p;
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 15)  {
      currentPalette = OceanColors_p;
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 20)  {
      currentPalette = ForestColors_p;
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 25)  {
      currentPalette = CloudColors_p;
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 30)  {
      currentPalette = PartyColors_p;
      currentBlending = LINEARBLEND;
    }
    if ( secondHand == 35)  {
      currentPalette = RainbowStripeColors_p;
      currentBlending = LINEARBLEND;
    }
  }
}
void SetupTotallyRandomPalette() {
  for ( int i = 0; i < 16; i++) {
    currentPalette[i] = CHSV( random8(), 255, random8());
  }
};

Semoga dapat bermanfaat. Jangan lupa share …