Buzzer Not Working, Unable to Debug

Buzzer not Working.

My Connections are:

Long Pin of Buzzer to Pin 0 (Digital) (The one next to A0)
Short Pin of Buzzer to GND

Here’s my code:

Bolt IoT Platform
    <script type="text/javascript" src="https://cloud.boltiot.com/static/js/boltCommands.js"></script>
    
    <script>
        setKey('{{APIKEY}}','{{Name}}');
    </script>
</head>

<body>
    <center>
        <button onclick="digitalWrite(0,'HIGH');">On</button>
        <button onclick="digitalWrite(0,'LOW');">Off</button>
    </center>
</body>

Once try placing the buzzer b/w 3.3V or 5V and gnd and see whether it’s sounding or not.
If not, then the buzzer isn’t working.

1 Like

@simardeepsngh1 The syntax for setting the key is wrong. The correct syntax is,

<script type="text/javascript">setKey('{{ApiKey}}','{{Name}}');</script>

Try to change frequency of buzzer
If not working change buzzer
change “value” in code from 0-255

You can use ‘analogWrite’ for trying out the simple buzzer project. You can vary the value from 0 to 255 in the first statement to vary the frequency of the buzzer. Hope it helps.