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: 1118547" data-attributes="member: 91197"><p>Well, I just ended up using Adafruit's NeoPixel library. It works fine! Feel free to use my AtmoDuino code! I think it's just some bug in FastLED or something.</p><p></p><p>[code]</p><p>#include <Adafruit_NeoPixel.h></p><p></p><p>#define NUM_LEDS 64</p><p>#define DATA_PIN 3</p><p>#define COLOR_ORDER NEO_GRB</p><p>#define STRIP_RATE NEO_KHZ800</p><p></p><p>Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, DATA_PIN, COLOR_ORDER + STRIP_RATE);</p><p></p><p>void setup(){</p><p> Serial.begin(115200);</p><p></p><p> strip.begin();</p><p> strip.show(); // Initialize all pixels to 'off'</p><p> loopLeds;</p><p> strip.clear();</p><p> strip.show();</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> switch(j) {</p><p> case 0: strip.setPixelColor(i, strip.Color(255, 0, 0)); break;</p><p> case 1: strip.setPixelColor(i, strip.Color(0, 255, 0)); break;</p><p> case 2: strip.setPixelColor(i, strip.Color(0, 0, 255)); break;</p><p> }</p><p> strip.show();</p><p> delay(5);</p><p> }</p><p> }</p><p>}</p><p></p><p></p><p>void loop() {</p><p> if(readByte() == 0xFF){</p><p> if(readByte() == 0x00){</p><p> if(readByte() == 0x00){</p><p> </p><p> int channels = readByte();</p><p> </p><p> for(int dot = 0; dot < channels; dot++){</p><p> int r = readByte();</p><p> int g = readByte();</p><p> int b = readByte();</p><p> </p><p> strip.setPixelColor(dot, strip.Color(r, g, b));</p><p> }</p><p> </p><p> strip.show();</p><p> }</p><p> }</p><p> }</p><p>}</p><p>[/code]</p></blockquote><p></p>
[QUOTE="Dragy, post: 1118547, member: 91197"] Well, I just ended up using Adafruit's NeoPixel library. It works fine! Feel free to use my AtmoDuino code! I think it's just some bug in FastLED or something. [code] #include <Adafruit_NeoPixel.h> #define NUM_LEDS 64 #define DATA_PIN 3 #define COLOR_ORDER NEO_GRB #define STRIP_RATE NEO_KHZ800 Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, DATA_PIN, COLOR_ORDER + STRIP_RATE); void setup(){ Serial.begin(115200); strip.begin(); strip.show(); // Initialize all pixels to 'off' loopLeds; strip.clear(); strip.show(); } 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++ ) { switch(j) { case 0: strip.setPixelColor(i, strip.Color(255, 0, 0)); break; case 1: strip.setPixelColor(i, strip.Color(0, 255, 0)); break; case 2: strip.setPixelColor(i, strip.Color(0, 0, 255)); break; } strip.show(); delay(5); } } } void loop() { if(readByte() == 0xFF){ if(readByte() == 0x00){ if(readByte() == 0x00){ int channels = readByte(); for(int dot = 0; dot < channels; dot++){ int r = readByte(); int g = readByte(); int b = readByte(); strip.setPixelColor(dot, strip.Color(r, g, b)); } strip.show(); } } } } [/code] [/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