Creating a slider

How do we create a slider in html and JS for controlling the frequency of the buzzer


I hope this helps

Code
<input type="range" min="0" max="255" value="0"/>

This code will be helpful for changing different buzzer frequencies with Slider Input of HTML using JavaScript onchange event.
Using this code you can Generate Different Frequency Depending upon you Slider value that values in between 0 to 255 and OFF button to turn off buzzer.
onchange() event of slider sets the frequency value of buzzer when you press enter.

<html>
<head>
    <script type="text/javascript" src="https://cloud.boltiot.com/static/js/boltCommands.js"></script>
    <script> setKey('{{ApiKey}}','{{Name}}'); </script>
</head>
<body>
<center>
   <input type="range" min="0" max="255" value="100" onchange="analogWrite(0,this.value); console.log('this.value');">
  <button onclick="digitalWrite(0, 'LOW');" >OFF</button>
</center>
</body>
</html>
3 Likes