Buzzer code not working

Hi I tried to run the same code I used in led to buzzer( without resistor) but it is not working. Can somebody help?

    <!DOCTYPE html>
            <title>Bolt IoT Platform</title>
            <script type="text/javascript" src=""></script>
            <button onclick="digitalWrite(0,'HIGH');">ON</button>
            <button onclick="digitalWrite(0, 'LOW');">OFF</button>

First off, not getting into details of the syntax or logical errors.

since you’ve used the buzzer without any resistor, there is a slight chance that it’s broken. I’d say you check it by giving it direct voltage through 3v3 via resistor to check if it is working or not.

If it is working let’s proceed further.
I’ll consider your script is correct. About the button there may be a case of de-bouncing where the connection which is completed by pressing the button bounces multiple times which may give false number of button clicks.

make sure your variables are correct and pins selected is “0” only.
Reply to this for more help.


To check if your code is correct -

First, connect a Led to the 0 and GND pin and check if it working with your code(Without register). If it working it means your code is fine. There is some issue with the buzzer connection.

If led it not working, it means there is some issue with the code. Open console in chrome and check for error or warning message.

How to connection the buzzer… and any prerequest before using the buzzer… In the buzzer it write… Remove seal after washing can i wash before using the buzzer??

1 Like

@bushrayasmin1998 The buzzer is not supposed to be washed. It is cleaned using a special cleaning solution before shipping.
You can peel off the cover if you like. Please DO NOT wash it with water.

Hi There!
Make sure that you have connected ‘-’ to GND & ‘+’ to 0 pin.
And if still not working try “analogWrite” instead of “digitalWrite” in code to buzz continue.

can you please elaborate further on checking if the buzzer is broken?

I simply mean that buzzer might not be working due to any short circuit or unconnected wires inside the buzzer.
Broken == Impaired

Use Buzzer without Resistor and Check the Connection then Re deploy the code. it will work.