Skip to content
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Logo
  1. ioBroker Community Home
  2. Deutsch
  3. Hardware
  4. Arduino Hilfe erbeten

NEWS

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    8.0k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    13
    1
    1.8k

  • Neues Video "KI im Smart Home" - ioBroker plus n8n
    BluefoxB
    Bluefox
    15
    1
    2.0k

Arduino Hilfe erbeten

Arduino Hilfe erbeten

Scheduled Pinned Locked Moved Hardware
arduino fire neopixel
1 Posts 1 Posters 495 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    e-s
    wrote on last edited by e-s
    #1

    Hallo,
    wie hier geschrieben war ich auf der Suche nach einer Flamme für einen Feuerkorb.
    Ich habe mir jetzt eine LED Kette gekauft mit 144 WS2812b LEDs.
    Hab mir jetzt diese Variante geflasht, um genau zu sein davon die EspNeoPixelBus Variante.
    Prinzipiell ist das auch schon ganz nett, aber da ich die Leds nicht als langen Stab nutzen will, stört mich der weiße Teil. Ich möchte also nur rot und gelb flackern lassen auf komplette Länge.

    Wo muss ich das genau ändern?
    Wahrscheinlich in dem Codeteil, oder?

    #include "Fire.h"
    
    #define FRAMES_PER_SECOND 60
    bool gReverseDirection = false;
    
    #define NUM_LEDS 144
    CRGB leds[NUM_LEDS];
    
    // make sure to set this to the correct pin, ignored for Esp8266
    #define LED_PIN  3
    
    // NOTE: These will ignore the LED_PIN and use GPI03 pin
    NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(NUM_LEDS, LED_PIN);
    
    byte brightness = 31;
    
    
    void setupFire(void)
    {
      // this resets all the neopixels to an off state
      strip.Begin();
      strip.Show();
    
      Serial.println("NeoPixelBus started");
    }
    
    
    // Fire2012 by Mark Kriegsman, July 2012
    // as part of "Five Elements" shown here: http://youtu.be/knWiGsmgycY
    ////
    // This basic one-dimensional 'fire' simulation works roughly as follows:
    // There's a underlying array of 'heat' cells, that model the temperature
    // at each point along the line.  Every cycle through the simulation,
    // four steps are performed:
    //  1) All cells cool down a little bit, losing heat to the air
    //  2) The heat from each cell drifts 'up' and diffuses a little
    //  3) Sometimes randomly new 'sparks' of heat are added at the bottom
    //  4) The heat from each cell is rendered as a color into the leds array
    //     The heat-to-color mapping uses a black-body radiation approximation.
    //
    // Temperature is in arbitrary units from 0 (cold black) to 255 (white hot).
    //
    // This simulation scales it self a bit depending on NUM_LEDS; it should look
    // "OK" on anywhere from 20 to 100 LEDs without too much tweaking.
    //
    // I recommend running this simulation at anywhere from 30-100 frames per second,
    // meaning an interframe delay of about 10-35 milliseconds.
    //
    // Looks best on a high-density LED setup (60+ pixels/meter).
    //
    //
    // There are two main parameters you can play with to control the look and
    // feel of your fire: COOLING (used in step 1 above), and SPARKING (used
    // in step 3 above).
    //
    // COOLING: How much does the air cool as it rises?
    // Less cooling = taller flames.  More cooling = shorter flames.
    // Default 50, suggested range 20-100
    byte cooling = 50;
    
    // SPARKING: What chance (out of 255) is there that a new spark will be lit?
    // Higher chance = more roaring fire.  Lower chance = more flickery fire.
    // Default 120, suggested range 50-200.
    byte sparking = 120;
    
    
    void Fire2012(void)
    {
      // Array of temperature readings at each simulation cell
      static byte heat[NUM_LEDS];
    
      // Step 1.  Cool down every cell a little
      for ( int i = 0; i < NUM_LEDS; i++) {
        heat[i] = qsub8( heat[i],  random8(0, ((cooling * 10) / NUM_LEDS) + 2));
      }
    
      // Step 2.  Heat from each cell drifts 'up' and diffuses a little
      for ( int k = NUM_LEDS - 1; k >= 2; k--) {
        heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;
      }
    
      // Step 3.  Randomly ignite new 'sparks' of heat near the bottom
      if ( random8() < sparking ) {
        int y = random8(7);
        heat[y] = qadd8( heat[y], random8(160, 255) );
      }
    
      // Step 4.  Map from heat cells to LED colors
      for ( int j = 0; j < NUM_LEDS; j++) {
        CRGB color = HeatColor( heat[j]);
        int pixelnumber;
        if ( gReverseDirection ) {
          pixelnumber = (NUM_LEDS - 1) - j;
        } else {
          pixelnumber = j;
        }
        leds[pixelnumber] = color;
      }
    }
    
    
    long fireTimer;
    
    void keepFireAlive(void)
    {
      if (millis() > fireTimer + 1000 / FRAMES_PER_SECOND)
      {
        fireTimer = millis();
        Fire2012();
        RgbColor pixel;
        for (int i = 0; i < NUM_LEDS; i++)
        {
          pixel = RgbColor(leds[i].r, leds[i].g, leds[i].b);
          pixel = RgbColor::LinearBlend(pixel, RgbColor(0, 0, 0), (255 - brightness)/255.0);
          strip.SetPixelColor(i, pixel);
        }
        strip.Show();
      }
    }
    

    Danke schon mal

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    Support us

    ioBroker
    Community Adapters
    Donate

    603

    Online

    32.4k

    Users

    81.3k

    Topics

    1.3m

    Posts
    Community
    Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
    ioBroker Community 2014-2025
    logo
    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Recent
    • Tags
    • Unread 0
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe