To add a timer button on BOLT IoT

How to add a 30-second timer button to the Bolt Cloud JavaScript, PIN0 must be turned on for 30 seconds when the button is pressed

You can use the javascript timer function for this.
You may refer to this link for further information:

Hi @pavanesleeba,

You can use the timeout function.

<button onclick="led_on()">ON</button>
<script>
function led_on(){
  digitalWrite(0, 'HIGH');

  setTimeout(() => {
    digitalWrite(0, 'LOW');
   }, 30000);
}
</script>

Do let me know in case you need further assistance.

Hi @pavanesleeba,

You can not add timeout function in Dualbutton class, but you can write your javascript function to do that.

add the code below:

button = document.createElement("BUTTON");
button.classList.add("btn");
var text = document.createTextNode("On");
button.appendChild(text);

button.onclick = function() {
    digitalWrite(0, 'HIGH');
    setTimeout(() => {
        digitalWrite(0, 'LOW');
        
    }, 30000);
    
};

document.body.appendChild(button);