Report Bugs Here

Moderator: Mmiscool

User avatar
By heckler
#61684 Hey group,

I am experiencing a weird long delay of about 15 to 30 seconds before a io(servo,pin,val) takes effect or if it is already there then it goes away and comes back after about 27 seconds. BUT this is only when any of the neopixel commands are executed.

For example I can turn on an io(servo) command and be watching the expected PWM waveform on my o-scope but if I click a button on the web gui that executes any of the neo statements, even neo(cls) or neo.stripcolor, etc. then the servo waveform goes to zero for approx. 27 seconds then re-appears.

I am working on a project that uses neopixels as well as a servo.

I have seen it both with both an esp-01 module as well as a nodemcu module.

help!!

thanks
dwight
User avatar
By Mmiscool
#61687 Have you tried the servo command on more than just one pin?

I know that internaly in arduino it uses timers for the servo command. I wonder if there is some thing weird going on there. If you could post up a program that demonstrates this i will test and see if i might have to upgrade the neo pixel library.
User avatar
By heckler
#61714 Hi Mike,
Thanks for your attention on this possible bug.
Below is a test program that I have tested both on an esp-01 module and on a NodeMCU module.
I have also tested it on different gpio pins. (0 & 2 on the "01" module and 0,2,4,5 on the nodemcu)

The behavior is as follows.
You can click on any of the servo buttons and see the expected servo pwm. You can click back and forth to any of the servo settings and it changes as expected.

Once you have any of the servo outputs running and then click on either neopixel button "set all" or "all off" you will see the servo output go away for ~25 seconds and then re-appear.

I included the PWO buttons to see if the neo statement affects the pwo and it does to a much lesser extent.
If you have one of the pwo outputs running and then click a neo button the O-scope shows the pwo output stop just while the neo data is being sent and then it comes right back (whereas the servo stays off for a much longer period ~25 sec.)

You don't need to connect any hardware (neo pixels or servo) in order to observe the behavior. Just load the code into either an esp-01 or nodemcu module and run it.

Note I am seeing the nodemcu module crash and restart when I save the code but it did not start doing the save/crash until I added the PWO buttions. (Is there a limit of how many buttons you can have?)
The code seems to still run correctly after the save/crash)

I will post two versions of the code. One with and one without the PWO buttions.

Thanks so much for all you have done to create this amazing espBASIC and for your attention to this problem.

Dwight

Here is the test code... with PWO and SERVO...
Code: Select allneo.setup(0)
wprint "----- NeoPixel controls GPIO 0 ------"
wprint "<br>"
wprint "<br>"
wprint "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>"
wprint "----- Servo controls GPIO 2 ------"
wprint "<br>"
wprint "<br>"
button "S 000", [S0]
button "S 060", [S1]
button "S 120", [S2]
button "S 180", [S3]
wprint "<br>"
wprint "<br>"
wprint "----- PWO controls GPIO 2 ------"
wprint "<br>"
wprint "<br>"
button "PWO 50", [P0]
button "PWO 250", [P1]
button "PWO 500", [P2]
button "PWO 750", [P3]
wprint "<br>"
wprint "<br>"
button "Exit", [Exit]
wait
'
[Setall]
neo.stripcolor(0,15,rd,gn,bu)
wait
'
[Alloff]
timer 0
neo.cls()
wait
'
[S0]
io(servo,2,0)
wait
[S1]
io(servo,2,60)
wait
[S2]
io(servo,2,120)
wait
[S3]
io(servo,2,180)
wait
'
[P0]
io(pwo,2,50)
wait
[P1]
io(pwo,2,250)
wait
[P2]
io(pwo,2,500)
wait
[P3]
io(pwo,2,750)
wait
'
[Exit]
end


test code with just the SERVO output...
Code: Select allneo.setup(0)
wprint "----- NeoPixel controls GPIO 0 ------"
wprint "<br>"
wprint "<br>"
wprint "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>"
wprint "----- Servo controls GPIO 2 ------"
wprint "<br>"
wprint "<br>"
button "S 000", [S0]
button "S 060", [S1]
button "S 120", [S2]
button "S 180", [S3]
wprint "<br>"
wprint "<br>"
button "Exit", [Exit]
wait
'
[Setall]
neo.stripcolor(0,15,rd,gn,bu)
wait
'
[Alloff]
timer 0
neo.cls()
wait
'
[S0]
io(servo,2,0)
wait
[S1]
io(servo,2,60)
wait
[S2]
io(servo,2,120)
wait
[S3]
io(servo,2,180)
wait
'
[Exit]
end
User avatar
By heckler
#61715 Further discussion...

Is it possible that the timer used to send the NEO data is the same timer used for SERVO or PWO?? And therefore while any NEO data is being sent it is taking down the SERVO output or the PWO output?

But at least the PWO output comes right back whereas the SERVO output stays off for a MUCH longer time.

Is there a second timer available so that the servo output will not be interrupted during the sending of NEO data??

Or is it always going to be the case that NEO data output blocks any ongoing SERVO or PWO ?

just a few thoughts/questions
thanks
dwight