Multiple Output Pins

Hi Im using the mega 2580 with the ws2811 pixel lights and I’m currently trying to figure out how to use another output because for some odd reason when ever I have lights flash they send 100s of on signals to the board and it wont let the other switches do what they’re supposed to because the Arduino is still trying to catch up from the 100s of transmissions. So here is the sketch and i would be happy to hear any and all thoughts on what i should change as i am fairly new to coding in general and honestly don’t know what I’m doing.

do_not_touch_final_copy.ino (16.9 KB)

do not expect us to upload 16.9 k of code, add two dozen libraries, and analyze that code. you expect too much.

Can you please upload a simple but complete sketch that illustrates the problem

I would be glad to do that but I can't Find what's causing my problem. Now that i think about it i could've worded my post differently by saying that i just need to see code that would allow me to run 2 different data streams to 2 different set of lights using the same Arduino board

Maybe this modified Fire2012 demo will help; it uses 7 strips

#include <FastLED.h>

#define COLOR_ORDER GRB
#define CHIPSET     WS2812B
#define NUM_LEDS    60

#define BRIGHTNESS  40
#define FRAMES_PER_SECOND 10
//#define FRAMES_PER_SECOND 120

bool gReverseDirection = false;

CRGB leds[7][NUM_LEDS];

void setup()
{
  delay(3000); // sanity delay
  FastLED.addLeds<CHIPSET, A1, COLOR_ORDER>(leds[0], NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.addLeds<CHIPSET, A2, COLOR_ORDER>(leds[1], NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.addLeds<CHIPSET, A3, COLOR_ORDER>(leds[2], NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.addLeds<CHIPSET, A4, COLOR_ORDER>(leds[3], NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.addLeds<CHIPSET, A5, COLOR_ORDER>(leds[4], NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.addLeds<CHIPSET, A6, COLOR_ORDER>(leds[5], NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.addLeds<CHIPSET, A7, COLOR_ORDER>(leds[6], NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.setBrightness( BRIGHTNESS );
}

void loop()
{
  // Add entropy to random number generator; we use a lot of it.
  //random16_add_entropy( random());

  Fire2012(); // run simulation frame

  FastLED.show(); // display this frame
  FastLED.delay(1000 / FRAMES_PER_SECOND);
}


// 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
#define COOLING  90

// 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.
#define SPARKING 80


void Fire2012()
{
  // Array of temperature readings at each simulation cell
  static byte heat[NUM_LEDS];

  for (uint8_t stripCnt = 0; stripCnt < 7; stripCnt++)
  {

    // 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[stripCnt][pixelnumber] = color;
    }
  }
}

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.