ARDUINO Projects

  • Digital led

    Neopiexl an LED stripe you can control ever color of each LED individually and that gives you hundreds of options to make any light decoration you want.

    Demonstration

    Upload the code below but be aware how many LEDs in your strip that important, connect the power to Vin pin of the Arduino "Do not connect to 5V pin" and Gnd to ground pin and the same way with the led strip, connect DATA IN to Arduino pin number 3 but to protect your board connect a restorer 330 ohm that will be do the trick.

    Post

    Arduino code
    #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    3
    #define LED_TYPE    WS2811 // type of the led
    #define COLOR_ORDER GRB
    #define NUM_LEDS    12 // number of the led 
    CRGB leds[NUM_LEDS];
    byte counter=0;
    #define BRIGHTNESS          164 // full brightness
    #define FRAMES_PER_SECOND  120 // speed of the color changing 
    
    void setup() {
      Serial.begin(9600);
      delay(3000); 
      FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
      FastLED.setBrightness(BRIGHTNESS);
    }
    typedef void (*SimplePatternList[])();
    uint8_t gCurrentPatternNumber = 0;
    uint8_t gHue = 0; 
    uint8_t gHue1 = 155;  
    void loop()
    {
     
     fadeToBlackBy( leds, NUM_LEDS, 10);
      int pos = random16(NUM_LEDS);
      leds[pos] += CHSV( gHue,255,136);
      FastLED.delay(1000/FRAMES_PER_SECOND); 
      EVERY_N_MILLISECONDS( 200 ) { 
        if(gHue==0){gHue1=gHue1+10;}
        gHue++;
        if(gHue1<=19){gHue1=155;}
        } // slowly cycle the "base color" through the rainbow 
    }