home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
HTPC Projects
Hardware
Ambient Lighting System
[BUG] Some weird problems, Arduino (SainSmart) crashes
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Dragy" data-source="post: 1117255" data-attributes="member: 91197"><p>Okay, the capacitor did not solve the problem, it's still the same. I even encountered flickering of the leds at the beginning, but not anymore.</p><p></p><p>I am now using my Arduino Uno to debug. I have 1 WS2812B led on pin 13 and one "debug" led on pin 10. I am not using an external power supply in this setup, so I can rule out a lot of factors. The result is that the problem also occur with this setup. The leds get stuck when playing with the static color. What I can see is that the Arduino still gets serial code (RX led flashes) when playing with it, but the RGB led does not change. I am also testing this code:</p><p>[code]</p><p>#include <FastLED.h></p><p></p><p>// Set the number of leds in the strip.</p><p>#define NUM_LEDS 64</p><p>#define DATA_PIN 13</p><p>#define BRIGHTNESS 255</p><p>#define LED_TYPE WS2812B</p><p>#define COLOR_ORDER GRB</p><p>CRGB leds[NUM_LEDS];</p><p></p><p>void setup(){</p><p> Serial.begin(115200);</p><p> pinMode(10, OUTPUT);</p><p> pinMode(11, OUTPUT);</p><p> //sanity check delay - allows reprogramming if accidently blowing power w/leds</p><p> delay(2000);</p><p> FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);</p><p> FastLED.setBrightness(BRIGHTNESS);</p><p></p><p> setupLEDs();</p><p> loopLeds();</p><p> clearLeds();</p><p> //blinkLeds();</p><p>}</p><p></p><p>int readByte(){</p><p> while (Serial.available() == 0){ /* wait for data */ }</p><p> return Serial.read();</p><p>}</p><p></p><p>void loopLeds(){</p><p>for(int j = 0; j < 3; j++) {</p><p> for(int i = 0 ; i < NUM_LEDS; i++ ) {</p><p> memset(leds, 0, NUM_LEDS * 3);</p><p> switch(j) {</p><p> case 0: leds[i].r = 255; break;</p><p> case 1: leds[i].g = 255; break;</p><p> case 2: leds[i].b = 255; break;</p><p> }</p><p> FastLED.show();</p><p> delay(5);</p><p> }</p><p> }</p><p>}</p><p></p><p></p><p>void clearLeds(){</p><p> for(int dot = 0; dot < NUM_LEDS; dot++){</p><p> leds[dot] = CRGB::Black;</p><p> };</p><p> FastLED.show();</p><p>}</p><p></p><p>// shows colored LEDs for 500ms then blanks out ready to go</p><p>void setupLEDs()</p><p>{</p><p> memset(leds,150, sizeof(leds));</p><p> FastLED.show();</p><p> FastLED.delay(500);</p><p> memset(leds,0, sizeof(leds));</p><p> FastLED.show();</p><p>}</p><p></p><p>void loop() {</p><p></p><p> if(readByte() == 0xFF){</p><p> if(readByte() == 0x00){</p><p> if(readByte() == 0x00){</p><p> int channels = readByte();</p><p> for(int dot = 0; dot < channels; dot++){</p><p> leds[dot].r = readByte();</p><p> leds[dot].g = readByte();</p><p> leds[dot].b = readByte();</p><p> }</p><p> FastLED.show();</p><p></p><p> digitalWrite(10, HIGH);</p><p> delay(300);</p><p> digitalWrite(10, LOW);</p><p></p><p></p><p> }</p><p> }</p><p> }</p><p>}[/code]</p><p></p><p>This works fine, the RGB led (WS2812B) gets data once in a while and after that it has to wait 300ms to be able to receive a new signal. The failure is less likely to occur, but still happens after a while. The Arduino still gets serial data, but as it seems, never the "right" data. The RGB led and the normal LED never change/flash anymore.</p><p></p><p></p><p>EDIT:</p><p>What?! I just placed the led code in front of the FastLED code and the problem does not happen anymore!</p><p>Like this:</p><p>[code]</p><p>void loop() {</p><p> if(readByte() == 0xFF){</p><p> if(readByte() == 0x00){</p><p> if(readByte() == 0x00){</p><p> </p><p> digitalWrite(10, HIGH);</p><p> delay(150);</p><p> digitalWrite(10, LOW);</p><p></p><p> int channels = readByte();</p><p> for(int dot = 0; dot < channels; dot++){</p><p> leds[dot].r = readByte();</p><p> leds[dot].g = readByte();</p><p> leds[dot].b = readByte();</p><p> }</p><p> FastLED.show();</p><p> }</p><p> }</p><p> }</p><p>}</p><p>[/code]</p><p></p><p>Maybe it's because of the delay?</p><p></p><p>Edit:</p><p>I tested it, the lowest I could get is 6ms delay. I can put it anywhere before the FastLED.show(), but the output is not okay. The leds don't lock up, but it's not the right solution because the output to the leds is not okay. I get different colors or flashes when playing with the static color sliders. Color changer mode is okay.</p><p></p><p>I have no idea what's going on.</p></blockquote><p></p>
[QUOTE="Dragy, post: 1117255, member: 91197"] Okay, the capacitor did not solve the problem, it's still the same. I even encountered flickering of the leds at the beginning, but not anymore. I am now using my Arduino Uno to debug. I have 1 WS2812B led on pin 13 and one "debug" led on pin 10. I am not using an external power supply in this setup, so I can rule out a lot of factors. The result is that the problem also occur with this setup. The leds get stuck when playing with the static color. What I can see is that the Arduino still gets serial code (RX led flashes) when playing with it, but the RGB led does not change. I am also testing this code: [code] #include <FastLED.h> // Set the number of leds in the strip. #define NUM_LEDS 64 #define DATA_PIN 13 #define BRIGHTNESS 255 #define LED_TYPE WS2812B #define COLOR_ORDER GRB CRGB leds[NUM_LEDS]; void setup(){ Serial.begin(115200); pinMode(10, OUTPUT); pinMode(11, OUTPUT); //sanity check delay - allows reprogramming if accidently blowing power w/leds delay(2000); FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS); FastLED.setBrightness(BRIGHTNESS); setupLEDs(); loopLeds(); clearLeds(); //blinkLeds(); } int readByte(){ while (Serial.available() == 0){ /* wait for data */ } return Serial.read(); } void loopLeds(){ for(int j = 0; j < 3; j++) { for(int i = 0 ; i < NUM_LEDS; i++ ) { memset(leds, 0, NUM_LEDS * 3); switch(j) { case 0: leds[i].r = 255; break; case 1: leds[i].g = 255; break; case 2: leds[i].b = 255; break; } FastLED.show(); delay(5); } } } void clearLeds(){ for(int dot = 0; dot < NUM_LEDS; dot++){ leds[dot] = CRGB::Black; }; FastLED.show(); } // shows colored LEDs for 500ms then blanks out ready to go void setupLEDs() { memset(leds,150, sizeof(leds)); FastLED.show(); FastLED.delay(500); memset(leds,0, sizeof(leds)); FastLED.show(); } void loop() { if(readByte() == 0xFF){ if(readByte() == 0x00){ if(readByte() == 0x00){ int channels = readByte(); for(int dot = 0; dot < channels; dot++){ leds[dot].r = readByte(); leds[dot].g = readByte(); leds[dot].b = readByte(); } FastLED.show(); digitalWrite(10, HIGH); delay(300); digitalWrite(10, LOW); } } } }[/code] This works fine, the RGB led (WS2812B) gets data once in a while and after that it has to wait 300ms to be able to receive a new signal. The failure is less likely to occur, but still happens after a while. The Arduino still gets serial data, but as it seems, never the "right" data. The RGB led and the normal LED never change/flash anymore. EDIT: What?! I just placed the led code in front of the FastLED code and the problem does not happen anymore! Like this: [code] void loop() { if(readByte() == 0xFF){ if(readByte() == 0x00){ if(readByte() == 0x00){ digitalWrite(10, HIGH); delay(150); digitalWrite(10, LOW); int channels = readByte(); for(int dot = 0; dot < channels; dot++){ leds[dot].r = readByte(); leds[dot].g = readByte(); leds[dot].b = readByte(); } FastLED.show(); } } } } [/code] Maybe it's because of the delay? Edit: I tested it, the lowest I could get is 6ms delay. I can put it anywhere before the FastLED.show(), but the output is not okay. The leds don't lock up, but it's not the right solution because the output to the leds is not okay. I get different colors or flashes when playing with the static color sliders. Color changer mode is okay. I have no idea what's going on. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
HTPC Projects
Hardware
Ambient Lighting System
[BUG] Some weird problems, Arduino (SainSmart) crashes
Contact us
RSS
Top
Bottom