WS2812B LED strip and ESP8266 shows wrong colors #5995
Replies: 1 comment
-
Posted at 2017-12-03 by MortenMoulder Turns out I have to run the code twice. The first time I run it, it doesn't make the colors just right, but the second time I run it, the colors are fine. Oh well. Posted at 2017-12-04 by @gfwilliams Ahh, thanks for letting us know! More than likely it's the state of the pin at boot that is the issue. Probably just calling Posted at 2017-12-04 by MortenMoulder Definitely! Posted at 2018-01-24 by user85573 Just FYI in the new 1v95, the neopixel module is not part of esp8266, usage is like any other Espruino platform:
Posted at 2018-01-25 by @allObjects @user85573, if by chance you have the setup, could you do some timing on these variations of the code and post the results? Variation 1(a))
Variation 2(a))
And as begin curious what the calculation vs communication times are:
and
The results may shed some light on how coding in Espruino can matter for execution speed. (The different start-up is not part of the timings. It just makes sure that the upload is not interfering) Posted at 2018-01-26 by @MaBecker This is the reason you have to run a extra neopixel.write() command: Every time you upload with reset some extra pinMode commands are included:
This is very helpful, because you always start with the same defined pinMode for all pins. I suggest to include a pinMode() for pins you use different.
Attachments: Posted at 2018-01-26 by user85573 v1(a) v2(a) v2(b) v2(c) v2 variants needed some remediation on
Posted at 2018-01-27 by @allObjects @user85573, thank you very much for you effort... (and mending the t0... copy/paste shoving code around tripped me... and still is. May be does not matter because the times as captured by you show already a nice difference...) My intensions for timing instrumentation are never to include console out... but I missed that part too. The correct code for 2(b) would be more along these lines: Variation 2(b))
I was missing line 13 completely and line 20 I should have made to read:
But anyway, thanks for timing it for me. Conclusion is that doing some optimization to prevent (source code) interpreter to do some things all over again saved about 20..25%. The numbers also show that the write is practically neglectable compared to the trigonometric calculations. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2017-12-03 by MortenMoulder
Hi! I finally got Espruino running on my ESP8266 12-E NodeMCU, but I'm having some issues talking to my strip correctly. When I was controlling my strip using Arduino and C before, I hooked up the data pin to RX, which worked just fine. Now I'm (apparently) supposed to hook it up to D2, or any of the pins near it, but the colors are all wrong.
When I do something like:
The first LED shines 70% yellow 30% green, if I do [0, 255, 0] it's 90% white 10% purple, and if I do [0, 0, 255] it's 80% white 20% blue (something like that).
It's not red, green, or blue as it's supposed to be. Any clue why?
Oh, and I also tried this:
but that yields the same result.
EDIT: I found this code in another post, which actually works fine:
BUT! If I simply comment out the setInterval() and just write colorLeds(255, 0, 0) they all shine with a purple hue. What on earth???
Beta Was this translation helpful? Give feedback.
All reactions