Code Monkey home page Code Monkey logo

fastled_examples's People

Contributors

marmilicious avatar mattncsu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fastled_examples's Issues

adding extra segments

hey mate, sorry for reaching out, just wondering if you can give me some input into adding a 3rd segment.

Cheers

Color palette half working

I am usig this code for a project with an arduino uno and a ws2812b strip with 17 leds, I am trying to set the color palette to just marquee through cyan and green. But what this does is it first cycles through the colors I specified, and then continues showing random colors. Do you have any idea how to fix this?

palette_example2.ino

Am I correct in thinking void newGradientPalette() manual setup of palettes only works on something like ESP32 not AVR?

Reason being:

void newGradientPalette(){
  uint8_t xyz[16];  // Needs to be 4 times however many colors are being used.
                    // 3 colors = 12, 4 colors = 16, etc.

  hsv = CHSV(random8(), 255, 255);  // pick random hue
  hsv2rgb_rainbow( hsv, rgb);  // convert to R,G,B
  
  xyz[0] = 0;  // anchor of first color - must be zero
  xyz[1] = rgb.r;
  xyz[2] = rgb.g;
  xyz[3] = rgb.b;

  xyz[4] = random8(48,118);  // random anchor point for second color
  xyz[5] = 255;
  xyz[6] = 0;
  xyz[7] = 0;
  
  xyz[8] = random8(138,225);  // random anchor point for third color
  xyz[9] = 0,
  xyz[10] = 255;
  xyz[11] = 0;

  hsv = CHSV(random8(), 255, 255);  // pick random hue
  hsv2rgb_rainbow( hsv, rgb);  // convert to R,G,B

  xyz[12] = 255;  // anchor of last color - must be 255
  xyz[13] = rgb.r;
  xyz[14] = rgb.g;
  xyz[15] = rgb.b;

  currentPalette = xyz;

  for (int p = 0; p < NUM_LEDS; p++) {
    leds[p] = ColorFromPalette(currentPalette, p*255/(NUM_LEDS-1), BRIGHTNESS, NOBLEND);
  }

}

this line:
currentPalette = xyz;

Will call the following constructor:

 CRGBPalette16& operator=( TProgmemRGBGradientPalette_bytes progpal )
    {
				Serial.println("oeperator called321");

        TRGBGradientPaletteEntryUnion* progent = (TRGBGradientPaletteEntryUnion*)(progpal);
        TRGBGradientPaletteEntryUnion u;

        // Count entries
        uint16_t count = 0;
        do {
            u.dword = FL_PGM_READ_DWORD_NEAR(progent + count);
            ++count;
        } while ( u.index != 255);

        int8_t lastSlotUsed = -1;

        u.dword = FL_PGM_READ_DWORD_NEAR( progent);
        CRGB rgbstart( u.r, u.g, u.b);

        int indexstart = 0;
        uint8_t istart8 = 0;
        uint8_t iend8 = 0;
        while( indexstart < 255) {
            ++progent;
            u.dword = FL_PGM_READ_DWORD_NEAR( progent);
            int indexend  = u.index;
            CRGB rgbend( u.r, u.g, u.b);
            istart8 = indexstart / 16;
            iend8   = indexend   / 16;
            if( count < 16) {
                if( (istart8 <= lastSlotUsed) && (lastSlotUsed < 15)) {
                    istart8 = lastSlotUsed + 1;
                    if( iend8 < istart8) {
                        iend8 = istart8;
                    }
                }
                lastSlotUsed = iend8;
            }
            fill_gradient_RGB( &(entries[0]), istart8, rgbstart, iend8, rgbend);
            indexstart = indexend;
            rgbstart = rgbend;
        }
        return *this;
    }

Which expects the data to be from progmem....

I've been using your code on my esp32, and works fine..

I tried it on an Arduino and got random colours.

Guessing this is because on esp32 progmem is mapped to normal memory. So it works fine, but on arduino progmem is expected to be in flash memory so it looks there and just gets junk data.

I think what would need to happen on an Arduino is:

  currentPalette.loadDynamicGradientPalette(xyz);
  
  Not
  currentPalette = xyz;
  

Question on heart_pulse_blood_flowing.ino example

Hey Marc,
Sorry for reaching out to you through github - but couldn't find a better way to do it...
I have been trying to figure out something in your sketch heart_pulse_blood_flowing.ino example:
On line 50 you have:
uint8_t bloodVal = sumPulse( (5/NUM_LEDS/2) + (NUM_LEDS/2) * i * flowDirection );
How is (5/NUM_LEDS/2) + (NUM_LEDS/2) calculated?
Thanks for your feedback - you can send me an email at [email protected]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.