Skip to content
  • Home
  • Aktuell
  • Tags
  • 0 Ungelesen 0
  • Kategorien
  • Unreplied
  • Beliebt
  • 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

  • Standard: (Kein Skin)
  • Kein Skin
Einklappen
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Hardware
  4. Arduino Hilfe erbeten

NEWS

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    16
    1
    1.3k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    782

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    25
    1
    2.0k

Arduino Hilfe erbeten

Geplant Angeheftet Gesperrt Verschoben Hardware
arduino fire neopixel
1 Beiträge 1 Kommentatoren 506 Aufrufe
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • E Offline
    E Offline
    e-s
    schrieb am zuletzt editiert von 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 Antwort Letzte Antwort
    0
    Antworten
    • In einem neuen Thema antworten
    Anmelden zum Antworten
    • Älteste zuerst
    • Neuste zuerst
    • Meiste Stimmen


    Support us

    ioBroker
    Community Adapters
    Donate

    744

    Online

    32.6k

    Benutzer

    82.0k

    Themen

    1.3m

    Beiträge
    Community
    Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
    ioBroker Community 2014-2025
    logo
    • Anmelden

    • Du hast noch kein Konto? Registrieren

    • Anmelden oder registrieren, um zu suchen
    • Erster Beitrag
      Letzter Beitrag
    0
    • Home
    • Aktuell
    • Tags
    • Ungelesen 0
    • Kategorien
    • Unreplied
    • Beliebt
    • GitHub
    • Docu
    • Hilfe