how stop my buzzer

I all,
I success my test outpout buzz .
I have a 3 buttons “low frequance (on)”, “hight frequence(off)”, " stop sound".
I use io.sockets

Saisissez io.sockets.on(‘connection’, function (socket) {
socket.on(‘led’, function (data) {
if(data ==‘stop’){
console.log(‘stop buzz’);

if (data == ‘on’){
//socket.emit(‘ledstatus’, ‘green’);
//socket.broadcast.emit(‘ledupdate’, ‘green’);

//socket.emit(‘ledstatus’, ‘red’);
//socket.broadcast.emit(‘ledupdate’, ‘red’);



if I clik low buzz and hight buzz is ok ,
but if I want stop buzzer, the buzzer not stop Why ?
console log is display stop buzz when i click stop
console log is display on when i click on
console log is display off when i click off
I try configure S_13 too HIGH but is have the PWM in this poin.
How I can do ?
thank’s for reply how i can stop the buzzer

Mixing digitalWrite and analogWrite could be the problem. Try disabling the buzzer by setting the PWM duty cycle to 0:

if(data ==‘stop’){
console.log(‘stop buzz’);

thanks michael my buzzer is stop :slight_smile: