Serial.begin "breaking" FastLED


hi all,

i've started mucking around fastled library , ws2812b leds. i'm trying learn fastled , part of using serial functions debug , understand example code.

my problem enable serial comms line serial.begin(baud); (on line 20 of following code) nothing works! leds light white , bright code being uploaded stay way. if push reset button stays way, if unplug usb cable plug in leds stay off.

commenting out line in question, serial.begin(baud); , uploading again works fine, leds fade through rainbowcolors_p expected.

with serial.begin(baud); being used lines print serial monitor outputting correct info in constant stream believe code looping , running correctly.
lines 47 & 48
code: [select]
serial.print("colorindex -> ");
serial.println(colorindex, dec);


i doubt problem fastled library or arduino. i'm running on linux box, new hardware, fedora 26. have had serial comms working no problems other code on same arduino.

any linux/arduino experts out there willing great!!

code follows:

code: [select]

#include <fastled.h>

#define led_pin     0   // digital pin output data
#define num_leds    8   // number of leds in string
#define brightness  32  // can 0-255
#define led_type    ws2812b
#define color_order grb
#define baud (115200)
crgb leds[num_leds];    // array of leds.  1 item each led in strip.

#define updates_per_second 50

crgbpalette16 currentpalette;
tblendtype    currentblending;

void setup() {
  delay(2000); // power-up safety delay

  serial.begin(baud); // setup serial comunication

  fastled.addleds<led_type, led_pin, color_order>(leds, num_leds).setcorrection( typicalledstrip );
  fastled.setbrightness(brightness);
}

void loop() {

  currentblending = linearblend;
  currentpalette = rainbowcolors_p;

  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;

  (int = 0; < num_leds; i++) {
    leds[i] = colorfrompalette(currentpalette, colorindex, brightness, currentblending);
    colorindex += 3;

    serial.print("colorindex -> ");
    serial.println(colorindex, dec);

  }
}

here's problem:
code: [select]

#define led_pin     0   // digital pin output data

serial uses pins 0 , 1 can't use pin 0 control led strip.


Arduino Forum > Using Arduino > Programming Questions > Serial.begin "breaking" FastLED


arduino

Comments

Popular posts from this blog

Error compiling for board Arduino/Genuino Uno.

Installation database is corrupt

esp8266 (nodemcu 0.9) client.write très lent ???