Report Bugs Here

Moderator: Mmiscool

User avatar
By heckler
#46051 I have some NeoPixel code that works on ver 1.68 but does not seem to work on the latest build 2.0 A15

More specifically the "All Off" button works and the "Set All" seems to just turn them all on to white but not to the color determined by the silders.
The sliders do seem to be working because when you press the "Stats" button the code prints the correct values of the three sliders.
The "Set One" button does not seem to work at all.

The code is designed to work with an 8 LED neopixel strip.

Can anyone else confirm if any of the neopixel commands work in the later versions of espbasic ?
Here is the codel...
Code: Select allwprint "Red ====> "
slider rd 0 255
wprint "<br>"
wprint "Green ===> "
slider gn 0 255
wprint "<br>"
wprint "Blue ====> "
slider bu 0 255
wprint "<br>"
button "Set All" [Setall]
button "All Off" [Alloff]
wprint "<br>"
wprint "<br>"
button "Set One" [Setone]
wprint "<br>"
listbox "0,1,2,3,4,5,6,7" pix
wprint "<br>"
wprint "<br>"
wprint "<br>"
button "Exit" [Exit]
button "Stats" [Stats]
wait
[Setall]
neostripcolor(0,7,rd,gn,bu)
wait
'
[Stats]
serialprintln ramfree()
serialprintln flashfree()
serialprintln ip()
serialprint rd
serialprint gn
serialprintln bu
serialprintln " "
wait
'
[Alloff]
neocls()
wait
'
[Setone]
neo(pix,rd,gn,bu)
wait
'
[Exit]
end


thanks
dwight
User avatar
By cicciocb
#46063 If you look at the var page, you'll see that the variables are considered strings (shown between quotes ex ."255").
So you need to convert before to number using the function val.

In your case :
[Setall]
neostripcolor(0,7,val(rd),val(gn),val(bu))

[Setone]
neo(val(pix),val(rd),val(gn),val(bu))

This is a ESPBasic bug as the slider object always returns numerical value so its value should be considered as number.
I think that a fix is required.

CiccioCB
User avatar
By heckler
#46079 So I made the suggested changes and the code no longer works with the older version (which I expected, no problem)

So I updated the OS to ver 2.0 A15 and the code still does not work.
I get a message...
Red ====>
Failed to reach end of input expression, likely malformed input
syntax error on line 2


do I need to impliment the "slider" statement differently??

Thanks for any guidance or efforts to correct the bug :D

dwight