• 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

How to set html range slider position in code please

Q&A Forum › Category: ESP32 › How to set html range slider position in code please
0 Vote Up Vote Down
David Huisman asked 5 years ago

I am using the web based servo code as starting point for my app.
My code gets the slider position and when user clicks a “write” button on screen, the value is transferred from ESP32 to my host over serial uart. This works.
When the user clicks “read” the ESP32 gets the last value from the host via serial uart and updates “valueString”.
However, the slider position does not get updated on screen until I leave and return to the url.
For the life of me I can not figure out how , in code, to get the slider to update with this new value. The Ajax code in RND example for servo will update the “position” text automatically ok but I need a method to move the slider at the point I get new value. I tried html meta page refresh every 3 seconds but this kept looping last action (ie. If I last pressed “read” button then the read function kept repeating every page refresh.
I can see you can set a specific element value using getDocument… but this seems to only work in a script function and I could not call the script function outside the body of html code where I processed serial data.
 
Its probably very simple but I am a novice to html coding and unsure of the correct syntax,
Thanks for any help

Question Tags: set range slider value

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.