Skip to content

Example: testleds needs updating (find included update) #4

Closed

Description

@Hansaplast

I'm not very familiar with github, but I noticed that the example "testleds" was still relying on FastSPI_LED, so I updated the code ... I know this is not the way to do it, I just don't know the right way to contribute ... hopefully it's helpful ...

--- example code "testleds" ---

#include "FastLED.h"

#define NUM_LEDS 60

// Define the array of leds
CRGB leds[NUM_LEDS];

#define PIN 6

void setup()
{
  FastLED.addLeds<NEOPIXEL, PIN, RGB>(leds, NUM_LEDS);
}

void loop() { 
  // one at a time
  for(int j = 0; j < 3; j++) { 
    for(int i = 0 ; i < NUM_LEDS; i++ ) {
      memset(leds, 0, NUM_LEDS * 3);
      switch(j) { 
        case 0: leds[i].r = 255; break;
        case 1: leds[i].g = 255; break;
        case 2: leds[i].b = 255; break;
      }
      FastLED.show();
      delay(10);
    }
  }

  // growing/receeding bars
  for(int j = 0; j < 3; j++) { 
    memset(leds, 0, NUM_LEDS * 3);
    for(int i = 0 ; i < NUM_LEDS; i++ ) {
      switch(j) { 
        case 0: leds[i].r = 255; break;
        case 1: leds[i].g = 255; break;
        case 2: leds[i].b = 255; break;
      }
      FastLED.show();
      delay(10);
    }
    for(int i = NUM_LEDS-1 ; i >= 0; i-- ) {
      switch(j) { 
        case 0: leds[i].r = 0; break;
        case 1: leds[i].g = 0; break;
        case 2: leds[i].b = 0; break;
      }
      FastSPI_LED.show();
      delay(1);
    }
  }

  // Fade in/fade out
  for(int j = 0; j < 3; j++ ) { 
    memset(leds, 0, NUM_LEDS * 3);
    for(int k = 0; k < 256; k++) { 
      for(int i = 0; i < NUM_LEDS; i++ ) {
        switch(j) { 
          case 0: leds[i].r = k; break;
          case 1: leds[i].g = k; break;
          case 2: leds[i].b = k; break;
        }
      }
      FastLED.show();
      delay(3);
    }
    for(int k = 255; k >= 0; k--) { 
      for(int i = 0; i < NUM_LEDS; i++ ) {
        switch(j) { 
          case 0: leds[i].r = k; break;
          case 1: leds[i].g = k; break;
          case 2: leds[i].b = k; break;
        }
      }
      FastLED.show();
      delay(3);
    }
  }
}

Activity

  1. focalintent commented on Jan 3, 2014

    @focalintent
    Contributor

    Actually, it shouldn’t even be in there at all - i’ll remove the test case. It’s an accidental checking.

    —Dg

    On Jan 3, 2014, at 2:48 PM, Hansaplast [email protected] wrote:

    I'm not very familiar with github, but I noticed that the example "testleds" was still relying on FastSPI_LED, so I updated the code ... I know this is not the way to do it, I just don't know the right way to contribute ... hopefully it's helpful ...

    --- example code "testleds" ---

    #include "FastLED.h"

    #define NUM_LEDS 60

    // Define the array of leds
    CRGB leds[NUM_LEDS];

    #define PIN 6

    void setup()
    {
    FastLED.addLeds<NEOPIXEL, PIN, RGB>(leds, NUM_LEDS);
    }

    void loop() {
    // one at a time
    for(int j = 0; j < 3; j++) {
    for(int i = 0 ; i < NUM_LEDS; i++ ) {
    memset(leds, 0, NUM_LEDS * 3);
    switch(j) {
    case 0: leds[i].r = 255; break;
    case 1: leds[i].g = 255; break;
    case 2: leds[i].b = 255; break;
    }
    FastLED.show();
    delay(10);
    }
    }

    // growing/receeding bars
    for(int j = 0; j < 3; j++) {
    memset(leds, 0, NUM_LEDS * 3);
    for(int i = 0 ; i < NUM_LEDS; i++ ) {
    switch(j) {
    case 0: leds[i].r = 255; break;
    case 1: leds[i].g = 255; break;
    case 2: leds[i].b = 255; break;
    }
    FastLED.show();
    delay(10);
    }
    for(int i = NUM_LEDS-1 ; i >= 0; i-- ) {
    switch(j) {
    case 0: leds[i].r = 0; break;
    case 1: leds[i].g = 0; break;
    case 2: leds[i].b = 0; break;
    }
    FastSPI_LED.show();
    delay(1);
    }
    }

    // Fade in/fade out
    for(int j = 0; j < 3; j++ ) {
    memset(leds, 0, NUM_LEDS * 3);
    for(int k = 0; k < 256; k++) {
    for(int i = 0; i < NUM_LEDS; i++ ) {
    switch(j) {
    case 0: leds[i].r = k; break;
    case 1: leds[i].g = k; break;
    case 2: leds[i].b = k; break;
    }
    }
    FastLED.show();
    delay(3);
    }
    for(int k = 255; k >= 0; k--) {
    for(int i = 0; i < NUM_LEDS; i++ ) {
    switch(j) {
    case 0: leds[i].r = k; break;
    case 1: leds[i].g = k; break;
    case 2: leds[i].b = k; break;
    }
    }
    FastLED.show();
    delay(3);
    }
    }
    }
    —
    Reply to this email directly or view it on GitHub.

  2. Hansaplast commented on Jan 3, 2014

    @Hansaplast
    Author

    OK, no problem 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions