Coder Social home page Coder Social logo

Comments (4)

NimmLor avatar NimmLor commented on July 4, 2024 1

Sorry for the late response. I would have coded like this instead of using the XY helper function:

    for (uint8_t y = prevpos; y <= pos; y++) {
      for (uint8_t x = 0; x < LEAFCOUNT; x++) {
          for(int i = 0;i < LEDS_PER_LEAF;i++)
             leds[LEAFCOUNT * LEDS_PER_LEAF + i] = color;
    }

from esp8266-fastled-iot-webserver.

tihoangyeudau avatar tihoangyeudau commented on July 4, 2024

Sorry for the late response. I would have coded like this instead of using the XY helper function:

    for (uint8_t y = prevpos; y <= pos; y++) {
      for (uint8_t x = 0; x < LEAFCOUNT; x++) {
          for(int i = 0;i < LEDS_PER_LEAF;i++)
             leds[LEAFCOUNT * LEDS_PER_LEAF + i] = color;
    }

i tried yours but it cant work. there is blank effect. this is my code:

{
  // a colored dot sweeping back and forth, with fading trails
  fadeToBlackBy(leds, NUM_LEDS, 20);
  int pos = beatsin16(speed, 0, NUM_LEDS);
  static int prevpos = 0;
  //CRGB color = CHSV( gHue, 255, 192);
  CRGB color = ColorFromPalette(palettes[currentPaletteIndex], gHue, 255);
  for (uint8_t y = prevpos; y <= pos; y++) {
      for (uint8_t x = 0; x < LEAFCOUNT; x++) {
          for(int i = 0;i < PIXELS_PER_LEAF;i++)
             leds[LEAFCOUNT * PIXELS_PER_LEAF + i] = color;
    }
  }
 prevpos = pos;
 delay(1000 / FRAMES_PER_SECOND );
}

from esp8266-fastled-iot-webserver.

WarDrake avatar WarDrake commented on July 4, 2024

I don't know if you got this working, but this seems to do it for me.

void sinelon_leaf()
{
// a colored dot sweeping back and forth, with fading trails
fadeToBlackBy(leds, NUM_LEDS, 20);
int pos = beatsin16(speed, 0, LEAFCOUNT);
static int prevpos = 0;
CRGB color = ColorFromPalette(palettes[currentPaletteIndex], gHue, 255);
if (pos < prevpos) {
pos *= PIXELS_PER_LEAF;
fill_solid((leds + pos), (prevpos - pos) + PIXELS_PER_LEAF, color);
}
else {
fill_solid(leds + prevpos, (pos - prevpos) + PIXELS_PER_LEAF, color);
}
prevpos = pos;
delay(100);
}

I added it as an extra pattern.

from esp8266-fastled-iot-webserver.

tihoangyeudau avatar tihoangyeudau commented on July 4, 2024

Thank you

from esp8266-fastled-iot-webserver.

Related Issues (20)

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.