-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ws2812b support #3
Comments
hi again Why i want to use ws2812b ? because i already got one who left from another project and i want to recycle it. i start working on a ws2812b led strip with your milight.lua sketch. Got 2 succes and 1 probleme : i got succes by turn on and off all my pixel. Got probleme by changing color : Basicly to set a color to a single ws2812b we have to write :
Where 2 is the data pin and leds_grb is the color to set this color to the whole strip :
rep is the repeat fonction x is the pixel number As i'm a beginner on LUA script, i got a probleme by linking
on `if act then
Can you help me please ? |
well, i have no exp with ws2812, but if i understood you correctly, it would be something like: if act then
r, g, b = hslToRgb(current_hue, current_sat, current_lum)
leds_grb = string.char(g, r, b)
ws2812.write(2, leds_grb:rep(x))
end btw, here are some nice examples https://github.com/geekscape/nodemcu_esp8266/blob/master/examples/ws2812.lua |
thanks for your time i already try this and igot this error :
My Git : https://github.com/deennoo/ESP8266-ws2812b/tree/nodemcu |
ok, i think i see where is the problem. So to fix try to changing this line: return math.floor(r * 1023 + 0.5), math.floor(g * 1023 + 0.5), math.floor(b * 1023 + 0.5) to this one: return math.floor(r * 255 + 0.5), math.floor(g * 255 + 0.5), math.floor(b * 255 + 0.5) |
Bingo !!! it works !! Using Domoticz (home automation app, device is set as a rgb style and just on/off switch), and android app : wifi controller 2.0 next step ? lum and sat ! Edit : Lum/brightness works, just need to find a way to get sat... Thank again for your help !! |
Hi there,
Thanks for your work.
I try it and it run well !
I wondering if it can be modified for ws2812b led strip ? If yes which part of milight.lua have to be change ?
Thx
The text was updated successfully, but these errors were encountered: