• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

ESP32 response slider position in browser slow

Q&A Forum › Category: ESP32 › ESP32 response slider position in browser slow
0 Vote Up Vote Down
Dick van de Wetering asked 3 years ago

Using a slider to control a servo works fine, except the position of the slider is in the browser slow in updating.
The error message I receive in the VS terminal is: “ERROR: Too many messages queued”.   
It looks like the Websocket software is not fast enough to follow the movement of the slider.
Does anyone know how to solve this?
 

Question Tags: slider, websocket
9 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
Can you tell me which example are you using?
Regards,
Sara

0 Vote Up Vote Down
Dick van de Wetering answered 3 years ago

A modified 4_4 Multiple Web_Pages example I have used.
How can I send main.cpp and data files, in case you want to check?
 

0 Vote Up Vote Down
Dick van de Wetering answered 3 years ago

In Arduino IDE I made a simialr program with 4 sliders for servo’s and 4 schwitchs on 1 webpage.
This worked much better. I did notice that if I keep the mouse button pressed during moving the slider and release it at the desired position, it worked nicely.
But for a good feel moving a servo one would like to move the slider and the servo moves at the same pace, unilyou release the mouse button.

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
To share your code use a link to github gist or pastebin.
What event are you using on the slider? onmousemove, ounmousedown, or other?
Regards,
Sara
 

0 Vote Up Vote Down
Dick van de Wetering answered 3 years ago

I did use the example code:
<p class=”switch_slider”>
<input type=”range” onchange=”updateSliderPWM(this)” id=”slider1″ min=”0″ max=”100″ step=”1″ value =”0″ class=”slider”>
<output class=”bubble”></output>
</p>
When I add   onmousemove=”updateSliderPWM(this)” this makes no difference in behaviour.
Looking for a solution I found some code here: https://css-tricks.com/value-bubbles-for-range-inputs/
Below the slider I get now a number that changes real time when I move the slider. 
Now I try to find a way to use this number to pass to the ESP32. But htlm, css, javescript is quite new to me so that is quite a puzzle.
(Where can I find info hwo to use the picture, code inserts functions.)
 

0 Vote Up Vote Down
Dick van de Wetering answered 3 years ago

I made an extension of example 2_4 extending it from 1 to 4 sliders. This extended page I added in example 4_4 Multiple webpages. However using the temperature and humidity reading sometimes interfere in slider oparatiron, so I removed this sensor pages. The sliders werk OK, except of the error message  “ERROR: Too many messages queued”.  Another example using Arduino IDE very similar worked well, except the positon was passed to the servo after releasing the silder. WHat I found was that in this example in the HTML code was used <input type=”range” onchange=updateSliderPWM(this)”…. >. In the 2_4 eample was used  <input type=”range” oninput=updateSliderPWM(this)”…. >, this last wat results in immediate update of the value and the servo moves as you move the slider withour releasing it. However the browser does not update fast enough and you get an error message and the slider pin (thumb) moves irrigular if you move fast. If you move slow it behaves better, probably less data/sec. Maybe using Serial.println(..) if new data are available slows down the messaging but that will no make the slider faster. If anyone konws a way that the slider thumb if updated faster I would like to know. 

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
If the slider moves too fast and sends requests in all values that will crash the ESP32 because “too many requests”.
Have you tried increasing the step of the slider, so it doesn’t send soo many requests between values?
Regards,
Sara
 
 
 

0 Vote Up Vote Down
Dick van de Wetering answered 3 years ago

For the multiple slider page I used an example from you of ESP32_MUltiple_Slider_Webserver.
In there was in the script.js this code:

function onMessage(event) {
console.log(event.data);
var myObj = JSON.parse(event.data);
var keys = Object.keys(myObj);
for (var i = 0; i < keys.length; i++){
var key = keys[i];
document.getElementById(key).innerHTML = myObj[key];
document.getElementById(“slider”+ (i+1).toString()).value = myObj[key];
}
}
If I change that into  (code of example 2_4_Output_Slider_PWM_Websockets)

function onMessage(event) {
console.log(event.data);
}
 
The 4 sliders on 1 webpage work perfectly. No error mesages any more.
This subject can be closed.
 
 
 
 
 

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Ok.
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.