-->
Page 1 of 3

neopixel broken??

PostPosted: Sat Apr 23, 2016 5:14 pm
by heckler
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

Re: neopixel broken??

PostPosted: Sun Apr 24, 2016 4:43 am
by cicciocb
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

Re: neopixel broken??

PostPosted: Sun Apr 24, 2016 9:20 am
by heckler
Thank you cicciocb,

I will try your suggested corrections.

Thanks for all your efforts!
dwight

Re: neopixel broken??

PostPosted: Sun Apr 24, 2016 9:42 am
by heckler
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