These are chat archives for Makuna/NeoPixelBus

18th
Mar 2016
marksev1
@marksev1
Mar 18 2016 17:16
hello

so far I just copy-pasted this: #include <NeoPixelBus.h>

const uint16_t PixelCount = 8; // this example assumes 4 pixels, making it smaller will cause a failure
const uint8_t PixelPin = D8; // make sure to set this to the correct pin, ignored for Esp8266

NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);

now I don't know what is the equivalent of "strip.numPixels();" and "strip.setPixelColor(i, strip.HSVColor(hue,saturation,brightness));" in your library and with which variables i should replace this hue,saturation,brightness ?
trying to copy-paste change this code - https://gist.github.com/AdySan/bd23f7be5ca5a6a4563f :)
my own I have just local :)
I mean strip setPixelColor is also in your library
but its arguments are a bit different right
Aditya Tannu
@AdySan
Mar 18 2016 17:33
you can use soemthing like this for mthe example
Michael Miller
@Makuna
Mar 18 2016 17:34
strip.setPixelColor(i, strip.HSVColor(hue,saturation,brightness));

should be converted to

strip.SetPixelColor(I, HsbColor(hue,saturation, brightness));

generally, Hsb is the same as Hsv, but not always, as both don't have good standards.

marksev1
@marksev1
Mar 18 2016 17:34
ok thanks
Aditya Tannu
@AdySan
Mar 18 2016 17:35
// three element pixels, in different order and speeds
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
Michael Miller
@Makuna
Mar 18 2016 17:35
and strip.numPixels() is the same as strip.PixelCount()
marksev1
@marksev1
Mar 18 2016 17:36
thanks
AdySan I think I already copypasted that
Michael Miller
@Makuna
Mar 18 2016 17:37
that is the correct definition of the NeoPixelBus to match the code snippet you pasted.
marksev1
@marksev1
Mar 18 2016 17:38
Thanks
http://pastebin.com/4jmt8Pyx can you guys glance over this if all is like it should be? :)
Michael Miller
@Makuna
Mar 18 2016 17:39
if the colors don't show exactly the same, let me know and I can examine their Hsv implementation.
marksev1
@marksev1
Mar 18 2016 17:39
cool thanks, need to receive my ws2812s from china first :D
then I'll for sure let you know
Michael Miller
@Makuna
Mar 18 2016 17:41
you have a typo, the call to SetPixelColor is using a captital I instead of the variable i, the compiler should catch that though
marksev1
@marksev1
Mar 18 2016 17:42
aha I see now
so like this -> strip.SetPixelColor(i, HsbColor(hue,saturation, brightness));
Michael Miller
@Makuna
Mar 18 2016 17:43
yup
also, you are calling strip.Show() in a network callback. I would avoid this. Just remove the show calls from that call back and put it at the bottom of your Loop().
marksev1
@marksev1
Mar 18 2016 17:47
also strip.Begin()?
so there is left only "client.set_callback(callback);" in that place?
or no that should stay in void setup right
Michael Miller
@Makuna
Mar 18 2016 17:49
leave strip.Beging();strip.Show() in the setup(), that was good.
all other strip.Show() than in the setup() should be removed, and the "new" one you are putting in loop() will work great.
marksev1
@marksev1
Mar 18 2016 17:50
the strip.Show's which are under the if statements?
Michael Miller
@Makuna
Mar 18 2016 17:50
all of them ;-)
marksev1
@marksev1
Mar 18 2016 17:50
yes
do i need to move the if statements also there?
Aditya Tannu
@AdySan
Mar 18 2016 17:51
no they remain in the callback
Michael Miller
@Makuna
Mar 18 2016 17:51
no, just remove the calls to strip.Show() from those places.
just delete those lines.
marksev1
@marksev1
Mar 18 2016 17:52
ok
AdySan why do you use the relay?
I think I will remove that I just want the ws-leds
Aditya Tannu
@AdySan
Mar 18 2016 17:54
i dont, it's leftover form some other sketch
marksev1
@marksev1
Mar 18 2016 17:54
ok
and that LED thing too right
Aditya Tannu
@AdySan
Mar 18 2016 17:54
had a homeKit/mqtt controlled power switch
yes that too
marksev1
@marksev1
Mar 18 2016 17:55
so now it looks cool -> http://pastebin.com/iC1ZdBs5
Michael Miller
@Makuna
Mar 18 2016 17:56
I have to get going, I will be back in a few hours to check on questions/progress. The only strange thing I seen which I am not sure is a real problem is that I thought a Hsv/Hsb with a saturation of 0 is basically the same as a v/b being zero.
marksev1
@marksev1
Mar 18 2016 17:56
thanks!
I think that I placed strip.Show a bit too high in the void loop
now i placed it below
Michael Miller
@Makuna
Mar 18 2016 17:59
either place was fine, but the proper place for extensibility is outside that if like you just changed it too

nit picking here, ignore as you wish,

int i, j;

this is poor form, and used by articles and books to get more words on a page.

int i;
int j;

this is better. If you need to change j to uint8_t its easier and cleaner.

marksev1
@marksev1
Mar 18 2016 18:01
cool I'll ask you a few more things later when you come back :) (about animations)
Michael Miller
@Makuna
Mar 18 2016 18:02
the other nitpick is to avoid the old types like int, long, etc, and use the more standard uint8_t, int16_t instead.
marksev1
@marksev1
Mar 18 2016 18:02
can i mix and match them both? like if i were adding new things :)
to AdySan's sketch
like animations and stuff
Michael Miller
@Makuna
Mar 18 2016 18:03
some odl platforms int is 8 bits, newer ones its 32 bits. So its not obvious what its precision is and people assume as limits.h isn't always available.
got to go, see you soon
marksev1
@marksev1
Mar 18 2016 18:04
have fun!
marksev1
@marksev1
Mar 18 2016 18:16
@AdySan I'm gonna PM you with some questions
Michael Miller
@Makuna
Mar 18 2016 21:19
What ranges are Hue, Saturation, and Brightness being received as?
Aditya Tannu
@AdySan
Mar 18 2016 21:20
0-360, 0-1, 0-1
or maybe the last two are 0-100, dont remember
Michael Miller
@Makuna
Mar 18 2016 21:21
then the hue needs to be divided by 360 before being set on the HsvColor, as it takes 0.0-1.0 value.
strip.SetPixelColor(i, HsbColor(hue / 360.0f, saturation, brightness));
Michael Miller
@Makuna
Mar 18 2016 21:24
Is what is sent truly a Hsv color or is it a Hsl? I have a color object for HSL and HSB where HSB is often the same as HSV
Aditya Tannu
@AdySan
Mar 18 2016 21:24
yeah I remember it's not the same as yours, the brghtness value is 1 for maximum brightness
in your case it was 0.5
sorry i keep forgetting the terminology
HomeKit refers to it as brightness but i'm not sure if the terminology is correct
Hue: 0-360, Sat/Brightness: 0-100
Michael Miller
@Makuna
Mar 18 2016 21:30
yeah, don't get down on yourself, too many people think Brightness, HSL its Lightness(0.5 is peak), HSB is Brightness (1.0 is peak), and HSV is Value (often also 1.0 peak but actually can be several often mixed standards).
Ok, I see that you already divide by 100 for the brightness.
Aditya Tannu
@AdySan
Mar 18 2016 21:31
someone mentioned to me the otehr day, FastLED has color balancing
the Adafruit library colors looks a lot redder
does your library have any support for balancing colors?
could be a nice feature
Michael Miller
@Makuna
Mar 18 2016 21:33
Yeah, so does the Adafruit in some of the examples. The color balancing is just mapping values so you loose resolution of color for a more accurate color range. But the issue is each physical LED package has a different color range, so one range just brings it closer but not accurate.
I think I am going to add a sample that includes the map (like Adafruit) and let those who care take the extra time to map it.
It takes memory (256 bytes for the cheap way) to have the map, and few people actually care to be that accurate unless you are trying to display a video feed where you can see and compare the difference.
Aditya Tannu
@AdySan
Mar 18 2016 21:36
i see
And again, a table for which brand of pixels? The last I heard the next generation pixels are going to have this inside them; but who knows when they will include it.
Michael Miller
@Makuna
Mar 18 2016 21:47
Also, if you place the pixels behind a diffuser, it will darken the colors but blend them better, which changes perception.
If you ever spot a better link to a gama table, let me know. Its on my list, but I am actively working on matrix support and texture support.
Michael Miller
@Makuna
Mar 18 2016 22:01
I found another link, http://rgb-123.com/ws2812-color-output/, that provides the table and its slightly different than the Adafruit but close.
Aditya Tannu
@AdySan
Mar 18 2016 22:03
interesting
Michael Miller
@Makuna
Mar 18 2016 22:23
wow, I just ran the same formula and found that the table I generated was different from both that link and what adafruit has.
3DSasha
@3DSasha
Mar 18 2016 22:37
Hello, @Makuna. I plan to migrate with my DIY home project with 100 WS2812B leds from Arduino UNO to ESP8266. I used SD card (reading effects), LCD, IR remote, serial. Now I plan to use Blynk to WI-FI control my lights, maybe update effects by OTA, maybe something other ideas like Vixen sync or reading effects stream by WLAN. How do you think, ESP8266 and your lib have enough speed to play effects on 100 leds 25-30fps with smooth and without any lagging with active using Wi-Fi?
Patrik Mayer
@codmpm
Mar 18 2016 23:09
Hey there guys. @Makuna, I love your library. Exactly what I was searching for. But right now I'm stuck. Can't get it to work on the Olimex-ESP12. Do you have a wiring example or are there any caveats for the Olimex board? Thnx!