Jan-17-2021, 02:11 PM
Hi, I am working on my project to control my servo through python and a flask webpage.
I have been looking around for a simple way to constantly send and recieve values from the server and webpage, but have not been able.
Would be awesome if any one with more experience could give me some pointers or show similar projects which I can learn from.
Here is my code:
I have been looking around for a simple way to constantly send and recieve values from the server and webpage, but have not been able.
Would be awesome if any one with more experience could give me some pointers or show similar projects which I can learn from.
Here is my code:
from flask import Flask from flask_cors import CORS app = Flask(__name__) CORS(app) @app.route("/") def helloSlider(): return ''' <html> <body> <div class="slidecontainer"> <input type="range" min="1" max="100" value="50" class="slider" id="myRange"> <p>Value: <span id="demo"></span></p> </div> <script> var slider = document.getElementById("myRange"); var output = document.getElementById("demo"); output.innerHTML = slider.value; slider.oninput = function() { output.innerHTML = this.value; } </script> </body> </html> ''' if __name__ == "__main__": app.run(debug=True)