Elektronika.lt
 2024 m. balandžio 23 d. Projektas | Reklama | Žinokite | Klausimai | Prisidėkite | Atsiliepimai | Kontaktai
Paieška portale
EN Facebook RSS

 Kas naujo  Katalogas  Parduotuvės  Forumas  Tinklaraščiai
 Pirmas puslapisSąrašas
 Forumas / + pokalbiai
 - Paieška forume
 - D.U.K. / Forumo taisyklės
 - Narių sąrašas
 - Registruotis
 - Prisijungti

Elektronika.lt portalo forumas

Jūs esate neprisijungęs lankytojas. Norint dalyvauti diskusijose, būtina užsiregistruoti ir prisijungti prie forumo. Prisijungę galėsite kurti naujas temas, atsakyti į kitų užduotus klausimus, balsuoti forumo apklausose.

Administracija pasilieka teisę pašalinti pasisakymus bei dalyvius, kurie nesilaiko forumo taisyklių. Pastebėjus nusižengimus, prašome pranešti.

Dabar yra 2024 04 23, 10:25. Visos datos yra GMT + 2 valandos.
 Forumas » Mikrovaldikliai » WS2812 RBG strip
Jūs negalite rašyti naujų pranešimų į šį forumą
Jūs negalite atsakinėti į pranešimus šiame forume
Jūs negalite redaguoti savo pranešimų šiame forume
Jūs negalite ištrinti savo pranešimų šiame forume
Jūs negalite dalyvauti apklausose šiame forume
 
  
Puslapis 11
Pradėti naują temą  Atsakyti į pranešimą Rodyti ankstesnį pranešimą :: Rodyti kitą pranešimą 
 WS2812 RBG strip
PranešimasParašytas: 2020 12 27, 12:25 Pranešti apie taisyklių pažeidimą Atsakyti su citata
Enshteinas
Patyręs dalyvis
Patyręs dalyvis
Peržiūrėti vartotojo aprašymą Siųsti asmeninį pranešimą
Sveiki, gal galėtu kas padėti. Reikėjo greit papuošt kavinę, norėjos kažko kitokio. Nupirkau skaitmeninę RBG juostą WS2812B, pajungiau arduino UNO, sukėliau šį koda... http://easytechlearn.com/2020/10/28/amazing-light-effects-using-pixel-led/
Viskas veikia, atrodo geriau daugiau negu tikėjomes, bet pasibaigus visiems efektams, kodas nepasileidžia iš naujo, tiesiog pastringa, šviečia keli led, atjungus ir prijugus maitinimą iš naujo, vėl pasileidžia ir veikia iki paskutinio efekto. Ką reiktu pakeisti, kad kodas suktusi nepertraukiamai ?

Kodas:
#include <FastLED.h>

FASTLED_USING_NAMESPACE

// FastLED "100-lines-of-code" demo reel, showing just a few
// of the kinds of animation patterns you can quickly and easily
// compose using FastLED. 
//
// This example also shows one easy way to define multiple
// animations patterns and have them automatically rotate.
//
// -Mark Kriegsman, December 2014

#if defined(FASTLED_VERSION) && (FASTLED_VERSION < 3001000)
#warning "Requires FastLED 3.1 or later; check github for latest code."
#endif

#define DATA_PIN    6
#define LED_TYPE    WS2811
#define COLOR_ORDER GRB
#define NUM_LEDS    187

#define UPDATES_PER_SECOND 100
CRGB leds[NUM_LEDS];


#define BRIGHTNESS          255
#define FRAMES_PER_SECOND  120
#define COOLING  55
#define SPARKING 120



bool gReverseDirection = false;
CRGBPalette16 gPal;


CRGBPalette16 pacifica_palette_1 =
    { 0x000507, 0x000409, 0x00030B, 0x00030D, 0x000210, 0x000212, 0x000114, 0x000117,
      0x000019, 0x00001C, 0x000026, 0x000031, 0x00003B, 0x000046, 0x14554B, 0x28AA50 };
CRGBPalette16 pacifica_palette_2 =
    { 0x000507, 0x000409, 0x00030B, 0x00030D, 0x000210, 0x000212, 0x000114, 0x000117,
      0x000019, 0x00001C, 0x000026, 0x000031, 0x00003B, 0x000046, 0x0C5F52, 0x19BE5F };
CRGBPalette16 pacifica_palette_3 =
    { 0x000208, 0x00030E, 0x000514, 0x00061A, 0x000820, 0x000927, 0x000B2D, 0x000C33,
      0x000E39, 0x001040, 0x001450, 0x001860, 0x001C70, 0x002080, 0x1040BF, 0x2060FF };


CRGBPalette16 currentPalette;
TBlendType    currentBlending;

extern CRGBPalette16 myRedWhiteBluePalette;
extern const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM;
     
void setup() {
  delay(3000); // 3 second delay for recovery
 
  // tell FastLED about the LED strip configuration
  FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
   
  //FastLED.addLeds<LED_TYPE,DATA_PIN,CLK_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);

  // set master brightness control
  FastLED.setBrightness(BRIGHTNESS);
}


// List of patterns to cycle through.  Each is defined as a separate function below.
typedef void (*SimplePatternList[])();
SimplePatternList gPatterns = { rainbow, rainbowWithGlitter, confetti, sinelon, juggle, bpm,Fire2012,first_light,second_light,cylon,pacifica_loop,rgbsetdemo };
//SimplePatternList gPatterns = { rainbow, rainbowWithGlitter, confetti, sinelon, juggle, bpm,Fire2012,Fire2012WithPalette,first_light,second_light,cylon,pacifica_loop,rgbsetdemo,colorpalete };
//SimplePatternList gPatterns = { colorpalete };
uint8_t gCurrentPatternNumber = 0; // Index number of which pattern is current
uint8_t gHue = 0; // rotating "base color" used by many of the patterns
 
void loop()
{
  // Call the current pattern function once, updating the 'leds' array
  gPatterns[gCurrentPatternNumber]();

  // send the 'leds' array out to the actual LED strip
  FastLED.show(); 
  // insert a delay to keep the framerate modest
  FastLED.delay(1000/FRAMES_PER_SECOND);

  // do some periodic updates
  EVERY_N_MILLISECONDS( 20 ) { gHue++; } // slowly cycle the "base color" through the rainbow
  EVERY_N_SECONDS( 20 ) { nextPattern(); } // change patterns periodically
}

#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))

void nextPattern()
{
  // add one to the current pattern number, and wrap around at the end
  gCurrentPatternNumber = (gCurrentPatternNumber + 1) % ARRAY_SIZE( gPatterns);
}

void rainbow()
{
  // FastLED's built-in rainbow generator
  fill_rainbow( leds, NUM_LEDS, gHue, 7);
}

void rainbowWithGlitter()
{
  // built-in FastLED rainbow, plus some random sparkly glitter
  rainbow();
  addGlitter(80);
}

void addGlitter( fract8 chanceOfGlitter)
{
  if( random8() < chanceOfGlitter) {
    leds[ random16(NUM_LEDS) ] += CRGB::White;
  }
}

void confetti()
{
  // random colored speckles that blink in and fade smoothly
  fadeToBlackBy( leds, NUM_LEDS, 10);
  int pos = random16(NUM_LEDS);
  leds[pos] += CHSV( gHue + random8(64), 200, 255);
}

void sinelon()
{
  // a colored dot sweeping back and forth, with fading trails
  fadeToBlackBy( leds, NUM_LEDS, 20);
  int pos = beatsin16( 13, 0, NUM_LEDS-1 );
  leds[pos] += CHSV( gHue, 255, 192);
}

void bpm()
{
  // colored stripes pulsing at a defined Beats-Per-Minute (BPM)
  uint8_t BeatsPerMinute = 62;
  CRGBPalette16 palette = PartyColors_p;
  uint8_t beat = beatsin8( BeatsPerMinute, 64, 255);
  for( int i = 0; i < NUM_LEDS; i++) { //9948
    leds[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10));
  }
}

void juggle() {
  // eight colored dots, weaving in and out of sync with each other
  fadeToBlackBy( leds, NUM_LEDS, 20);
  byte dothue = 0;
  for( int i = 0; i < 8; i++) {
    leds[beatsin16( i+7, 0, NUM_LEDS-1 )] |= CHSV(dothue, 200, 255);
    dothue += 32;
  }
}

void Fire2012()
{
// 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;
    }
}

void first_light(){
  static uint8_t hue = 0;
   for(int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed = whiteLed + 1) {
      // Turn our current led on to white, then show the leds
      leds[whiteLed] =  CHSV(hue++, 255, 255);

      // Show the leds (only one of which is set to white, from above)
      FastLED.show();

      // Wait a little bit
      delay(1);

      // Turn our current led back to black for the next loop around
      leds[whiteLed] = leds[whiteLed] = CRGB::Black;
   }
}
void second_light(){
  static uint8_t hue = 0;
   for(int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed = whiteLed + 1) {
      // Turn our current led on to white, then show the leds
      leds[whiteLed] =  CHSV(hue++, 255, 255);

      // Show the leds (only one of which is set to white, from above)
      FastLED.show();

      // Wait a little bit
      delay(1);

      // Turn our current led back to black for the next loop around
      leds[whiteLed] = CHSV(hue++, 255, 255);
   }
}
void cylon(){
    static uint8_t hue = 0;
 // Serial.print("x");
  // First slide the led in one direction
  for(int i = 0; i < NUM_LEDS; i++) {
    // Set the i'th led to red
    leds[i] = CHSV(hue++, 255, 255);
    // Show the leds
    FastLED.show();
    // now that we've shown the leds, reset the i'th led to black
    // leds[i] = CRGB::Black;
    fadeall();
    // Wait a little bit before we loop around and do it again
    delay(5);
  }
  //Serial.print("x");

  // Now go in the other direction. 
  for(int i = (NUM_LEDS)-1; i >= 0; i--) {
    // Set the i'th led to red
    leds[i] = CHSV(hue++, 255, 255);
    // Show the leds
    FastLED.show();
    // now that we've shown the leds, reset the i'th led to black
    // leds[i] = CRGB::Black;
    fadeall();
    // Wait a little bit before we loop around and do it again
    delay(5);
  }
}
void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds[i].nscale8(250); } }

void Fire2012WithPalette()
{
// 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++) {
      // Scale the heat value from 0-255 down to 0-240
      // for best results with color palettes.
      byte colorindex = scale8( heat[j], 240);
      CRGB color = ColorFromPalette( gPal, colorindex);
      int pixelnumber;
      if( gReverseDirection ) {
        pixelnumber = (NUM_LEDS-1) - j;
      } else {
        pixelnumber = j;
      }
      leds[pixelnumber] = color;
    }
}
void rgbsetdemo(){
 CRGBArray<NUM_LEDS> leds;
  FastLED.addLeds<NEOPIXEL,6>(leds, NUM_LEDS);
  static uint8_t hue;
  for(int i = 0; i < NUM_LEDS/2; i++) {   
    // fade everything out
    leds.fadeToBlackBy(20);

    // let's set an led value
    leds[i] = CHSV(hue++,255,255);

    // now, let's first 20 leds to the top 20 leds,
    leds(NUM_LEDS/2,NUM_LEDS-1) = leds(NUM_LEDS/2 - 1 ,0);
    FastLED.delay(13);
  }
 
}

void pacifica_loop()
{
  // Increment the four "color index start" counters, one for each wave layer.
  // Each is incremented at a different speed, and the speeds vary over time.
  static uint16_t sCIStart1, sCIStart2, sCIStart3, sCIStart4;
  static uint32_t sLastms = 0;
  uint32_t ms = GET_MILLIS();
  uint32_t deltams = ms - sLastms;
  sLastms = ms;
  uint16_t speedfactor1 = beatsin16(3, 179, 269);
  uint16_t speedfactor2 = beatsin16(4, 179, 269);
  uint32_t deltams1 = (deltams * speedfactor1) / 256;
  uint32_t deltams2 = (deltams * speedfactor2) / 256;
  uint32_t deltams21 = (deltams1 + deltams2) / 2;
  sCIStart1 += (deltams1 * beatsin88(1011,10,13));
  sCIStart2 -= (deltams21 * beatsin88(777,8,11));
  sCIStart3 -= (deltams1 * beatsin88(501,5,7));
  sCIStart4 -= (deltams2 * beatsin88(257,4,6));

  // Clear out the LED array to a dim background blue-green
  fill_solid( leds, NUM_LEDS, CRGB( 2, 6, 10));

  // Render each of four layers, with different scales and speeds, that vary over time
  pacifica_one_layer( pacifica_palette_1, sCIStart1, beatsin16( 3, 11 * 256, 14 * 256), beatsin8( 10, 70, 130), 0-beat16( 301) );
  pacifica_one_layer( pacifica_palette_2, sCIStart2, beatsin16( 4,  6 * 256,  9 * 256), beatsin8( 17, 40,  80), beat16( 401) );
  pacifica_one_layer( pacifica_palette_3, sCIStart3, 6 * 256, beatsin8( 9, 10,38), 0-beat16(503));
  pacifica_one_layer( pacifica_palette_3, sCIStart4, 5 * 256, beatsin8( 8, 10,28), beat16(601));

  // Add brighter 'whitecaps' where the waves lines up more
  pacifica_add_whitecaps();

  // Deepen the blues and greens a bit
  pacifica_deepen_colors();
}

// Add one layer of waves into the led array
void pacifica_one_layer( CRGBPalette16& p, uint16_t cistart, uint16_t wavescale, uint8_t bri, uint16_t ioff)
{
  uint16_t ci = cistart;
  uint16_t waveangle = ioff;
  uint16_t wavescale_half = (wavescale / 2) + 20;
  for( uint16_t i = 0; i < NUM_LEDS; i++) {
    waveangle += 250;
    uint16_t s16 = sin16( waveangle ) + 32768;
    uint16_t cs = scale16( s16 , wavescale_half ) + wavescale_half;
    ci += cs;
    uint16_t sindex16 = sin16( ci) + 32768;
    uint8_t sindex8 = scale16( sindex16, 240);
    CRGB c = ColorFromPalette( p, sindex8, bri, LINEARBLEND);
    leds[i] += c;
  }
}

// Add extra 'white' to areas where the four layers of light have lined up brightly
void pacifica_add_whitecaps()
{
  uint8_t basethreshold = beatsin8( 9, 55, 65);
  uint8_t wave = beat8( 7 );
 
  for( uint16_t i = 0; i < NUM_LEDS; i++) {
    uint8_t threshold = scale8( sin8( wave), 20) + basethreshold;
    wave += 7;
    uint8_t l = leds[i].getAverageLight();
    if( l > threshold) {
      uint8_t overage = l - threshold;
      uint8_t overage2 = qadd8( overage, overage);
      leds[i] += CRGB( overage, overage2, qadd8( overage2, overage2));
    }
  }
}

// Deepen the blues and greens
void pacifica_deepen_colors()
{
  for( uint16_t i = 0; i < NUM_LEDS; i++) {
    leds[i].blue = scale8( leds[i].blue,  145);
    leds[i].green= scale8( leds[i].green, 200);
    leds[i] |= CRGB( 2, 5, 7);
  }
}

void colorpalete(){
   ChangePalettePeriodically();
   
    static uint8_t startIndex = 0;
    startIndex = startIndex + 1; /* motion speed */
   
    FillLEDsFromPaletteColors( startIndex);
   
    FastLED.show();
    FastLED.delay(1000 / UPDATES_PER_SECOND);
}


void FillLEDsFromPaletteColors( uint8_t colorIndex)
{
    uint8_t brightness = 255;
   
    for( int i = 0; i < NUM_LEDS; i++) {
        leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
        colorIndex += 3;
    }
}


// There are several different palettes of colors demonstrated here.
//
// FastLED provides several 'preset' palettes: RainbowColors_p, RainbowStripeColors_p,
// OceanColors_p, CloudColors_p, LavaColors_p, ForestColors_p, and PartyColors_p.
//
// Additionally, you can manually define your own color palettes, or you can write
// code that creates color palettes on the fly.  All are shown here.

void ChangePalettePeriodically()
{
    uint8_t secondHand = (millis() / 1000) % 60;
    static uint8_t lastSecond = 99;
   
    if( lastSecond != secondHand) {
        lastSecond = secondHand;
        if( secondHand ==  0)  { currentPalette = RainbowColors_p;         currentBlending = LINEARBLEND; }
        if( secondHand == 10)  { currentPalette = RainbowStripeColors_p;   currentBlending = NOBLEND;  }
        if( secondHand == 15)  { currentPalette = RainbowStripeColors_p;   currentBlending = LINEARBLEND; }
        if( secondHand == 20)  { SetupPurpleAndGreenPalette();             currentBlending = LINEARBLEND; }
        if( secondHand == 25)  { SetupTotallyRandomPalette();              currentBlending = LINEARBLEND; }
        if( secondHand == 30)  { SetupBlackAndWhiteStripedPalette();       currentBlending = NOBLEND; }
        if( secondHand == 35)  { SetupBlackAndWhiteStripedPalette();       currentBlending = LINEARBLEND; }
        if( secondHand == 40)  { currentPalette = CloudColors_p;           currentBlending = LINEARBLEND; }
        if( secondHand == 45)  { currentPalette = PartyColors_p;           currentBlending = LINEARBLEND; }
        if( secondHand == 50)  { currentPalette = myRedWhiteBluePalette_p; currentBlending = NOBLEND;  }
        if( secondHand == 55)  { currentPalette = myRedWhiteBluePalette_p; currentBlending = LINEARBLEND; }
    }
}

// This function fills the palette with totally random colors.
void SetupTotallyRandomPalette()
{
    for( int i = 0; i < 16; i++) {
        currentPalette[i] = CHSV( random8(), 255, random8());
    }
}

// This function sets up a palette of black and white stripes,
// using code.  Since the palette is effectively an array of
// sixteen CRGB colors, the various fill_* functions can be used
// to set them up.
void SetupBlackAndWhiteStripedPalette()
{
    // 'black out' all 16 palette entries...
    fill_solid( currentPalette, 16, CRGB::Black);
    // and set every fourth one to white.
    currentPalette[0] = CRGB::White;
    currentPalette[4] = CRGB::White;
    currentPalette[8] = CRGB::White;
    currentPalette[12] = CRGB::White;
   
}

// This function sets up a palette of purple and green stripes.
void SetupPurpleAndGreenPalette()
{
    CRGB purple = CHSV( HUE_PURPLE, 255, 255);
    CRGB green  = CHSV( HUE_GREEN, 255, 255);
    CRGB black  = CRGB::Black;
   
    currentPalette = CRGBPalette16(
                                   green,  green,  black,  black,
                                   purple, purple, black,  black,
                                   green,  green,  black,  black,
                                   purple, purple, black,  black );
}


// This example shows how to set up a static color palette
// which is stored in PROGMEM (flash), which is almost always more
// plentiful than RAM.  A static PROGMEM palette like this
// takes up 64 bytes of flash.
const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM =
{
    CRGB::Red,
    CRGB::Gray, // 'white' is too bright compared to red and blue
    CRGB::Blue,
    CRGB::Black,
   
    CRGB::Red,
    CRGB::Gray,
    CRGB::Blue,
    CRGB::Black,
   
    CRGB::Red,
    CRGB::Red,
    CRGB::Gray,
    CRGB::Gray,
    CRGB::Blue,
    CRGB::Blue,
    CRGB::Black,
    CRGB::Black
};



// Additional notes on FastLED compact palettes:
//
// Normally, in computer graphics, the palette (or "color lookup table")
// has 256 entries, each containing a specific 24-bit RGB color.  You can then
// index into the color palette using a simple 8-bit (one byte) value.
// A 256-entry color palette takes up 768 bytes of RAM, which on Arduino
// is quite possibly "too many" bytes.
//
// FastLED does offer traditional 256-element palettes, for setups that
// can afford the 768-byte cost in RAM.
//
// However, FastLED also offers a compact alternative.  FastLED offers
// palettes that store 16 distinct entries, but can be accessed AS IF
// they actually have 256 entries; this is accomplished by interpolating
// between the 16 explicit entries to create fifteen intermediate palette
// entries between each pair.
//
// So for example, if you set the first two explicit entries of a compact
// palette to Green (0,255,0) and Blue (0,0,255), and then retrieved
// the first sixteen entries from the virtual palette (of 256), you'd get
// Green, followed by a smooth gradient from green-to-blue, and then Blue.
 WS2812 RBG strip
PranešimasParašytas: 2020 12 27, 18:21 Pranešti apie taisyklių pažeidimą Atsakyti su citata
hencia
Patyręs dalyvis
Patyręs dalyvis
Peržiūrėti vartotojo aprašymą Siųsti asmeninį pranešimą
O neturėtų kažkur būti:
Kodas:
while (1) {...}
 WS2812 RBG strip
PranešimasParašytas: 2020 12 27, 19:07 Pranešti apie taisyklių pažeidimą Atsakyti su citata
Enshteinas
Patyręs dalyvis
Patyręs dalyvis
Peržiūrėti vartotojo aprašymą Siųsti asmeninį pranešimą
žodžiu turėjau dar viena mikrokontroleri,
ikėliau parasta timerio koda ir su juo restartuoju pirmaji. suprantu kad medinis sprendimas, bet nėra laiko gilintis i cc kalba Smile
 WS2812 RBG strip
PranešimasParašytas: 2020 12 28, 09:43 Pranešti apie taisyklių pažeidimą Atsakyti su citata
AlgisL
Senbuvis
Senbuvis
Peržiūrėti vartotojo aprašymą Siųsti asmeninį pranešimą
Sveikas, kai dariau kažką panašaus pries keletą metų, kompiliavau su stabilia laikoma 1.6.5 ir FastLED versija buvo senesnė, bet viskas veikė stabiliai.
Dar gali būti koks nors niuansas su pajungimu, jei ilgi laidai iki juostos (aš naudojau 6N137 atskyrimui ir vytą porą iki jos bei dvi varžikes po 150R "ant" + ir signalo).
Jei pastringa visada vienodoje vietoje, tai greičiau kažkokia velniava su programine dalimi (gal steką suvalgo), tad bandyk išjunginėti po vieną efektą, pakol atrasi kur bėdos slepiasi.
Jei ciklas nepastringa, o tik kintamieji nuplaukia, tai RESETĄ gali padaryti tame pat arduine su 300R..1k varžike į RESET piną.
setup'e:
Kodas:

  digitalWrite(reset_pin, HIGH);
  pinMode(reset_pin, INPUT);

gale viso ciklo:
Kodas:

void nextPattern()
{
  // add one to the current pattern number, and wrap around at the end
  gCurrentPatternNumber = (gCurrentPatternNumber + 1) % ARRAY_SIZE( gPatterns);
  if (!gCurrentPatternNumber) { //==0
    digitalWrite(reset_pin, LOW);
    pinMode(reset_pin, OUTPUT);
  }
}

Dar man keistas noras naudoti tą kinietišką "stebūklą" XL4015 ir dar taip neteisingai - maistas turi pradžioje ateiti iki juostos, o jau paskui nueiti iki arduino, o ne kažkur per vidurį ar nuo arduino...
Nepamaišys ir nors nedidukas LowESR elektrolitas prie juostos bei kažkas arduino, nes kiniečiai daugumoje labai nutaupo.
 WS2812 RBG strip
PranešimasParašytas: 2020 12 28, 10:49 Pranešti apie taisyklių pažeidimą Atsakyti su citata
gintaras_bar
Patyręs dalyvis
Patyręs dalyvis
Peržiūrėti vartotojo aprašymą Siųsti asmeninį pranešimą
Man taip buvo atsitikę, kai girliandos valdymo programą pabandžiau įrašyti į ATMEGA16, kuris turi dvigubai mažiau atminties, nei ATMEGA328 (kur UNO plokštėje yra naudojamas). Sumažinus naudojamų efektų, viskas susitvarkė.

Reiktų pasižiūrėti kompiliatoriaus pranešimus, gal būt atsiranda perspėjimas, jog nepakanka atminties. Ir tuomet arba efektų mažiau naudoti, arba imti Arduino su "riebesniu" mikrovaldikliu.
Pradėti naują temą  Atsakyti į pranešimą
 
Forumo sistema: phpBB
 „Google“ paieška forume
 Kas naujesnio?
 Naujos temos forume

Global electronic components distributor – Allicdata Electronics

Electronic component supply – „Eurodis Electronics“

LOKMITA – įvairi matavimo, testavimo, analizės ir litavimo produkcija

Full feature custom PCB prototype service

GENERAL FINANCING BANKAS

Mokslo festivalis „Erdvėlaivis Žemė

LTV.LT - lietuviškų tinklalapių vitrina

„Konstanta 42“

Technologijos.lt

Buitinė technika ir elektronika internetu žemos kainos – Zuza.lt

www.esaugumas.lt – apsaugok savo kompiuterį!

PriedaiMobiliems.lt – telefonų priedai ir aksesuarai

„Deinavos baldai“ — šeimos baldai

FS 22 Tractors
Farming Simulator 19 Mods, FS 22 Maps, FS22 Mods
ETS2 Mods
ETS2 Trucks, ETS2 Bus, Euro Truck Simulator 2 Mods
FS22 Tractors
Farming Simulator 22 Mods, FS22 Maps, FS22 Trucks
VAT calculator
VAT number check, What is VAT, How much is VAT
Paskola internetu
Vartojimo paskola, paskola automobiliui, paskola būsto remontui
Thermal monocular
Thermal vision camera,
Night vision ar scope,
Night vision spotting scope
FS22 Mods
FS22 Harvesters, FS22 Tractors Mods, FS22 Maps Mods
FS22 Mods
FS22 Maps,
FS22 Harvesters,
FS22 Tractors
Dantų protezavimas
All on 4 implantai,
Endodontija mikroskopu,
Dantų implantacija
Sims 4 Mods
Sims 4 CC Clothes,
Sims 4 Hair CC,
Sims 4 Skill Cheat
Optic sight
Binoculars for hunting elk,
Best compact binoculars,
Riflescope hunting
Reklama
‡ 1999– © Elektronika.lt | Autoriaus teisės | Privatumo politika | Atsakomybės ribojimas | Turinys | Reklama | Kontaktai LTV.LT - lietuviškų tinklalapių vitrina
Script hook v, Openiv, Menyoo
gta5mod.net
Farming Simulator 2019 Mods, FS22 Mods, FS22 Maps
farmingsimulator19mods.fr
Optical filters, UV optics, electro optical crystals
www.eksmaoptics.com
Reklamos paslaugos
SEO sprendimai

www.addad.lt
Elektroninių parduotuvių optimizavimas „Google“ paieškos sistemai
www.seospiders.lt
FS22 mods, Farming simulator 22 mods,
FS22 maps

fs22.com
Reklama


Reklama