The answer is simple add
digitalWrite(speakerOut,HIGH);
and common mistake made by beginners
if(buttonState=1) should actually be if(buttonState==1)
and never pull that pin LOW
if(buttonState = 1);{
digitalWrite(11, LOW);
}
is wrong use the below code
if(buttonState == 1)
{
digitalWrite(11, LOW);
}
The answer is simple add
digitalWrite(speakerOut,HIGH);Common mistake made by beginners is to use assign operator instead of compare operator
if(buttonState=1)should actually be
if(buttonState==1)Never pull that pin LOW
if(buttonState = 1);{ digitalWrite(11, LOW); }is wrong use the below code
if(buttonState == 1){ digitalWrite(11, LOW); }
and dontDon't forget to connect the button to buttonPin or you will get random HIGH or LOW from that pin since its floating
Hope this helps....