Confusion regarding analogWrite function

I’m trying to activate the buzzer with the analogWrite() function but what should the ‘value’ parameter be? In ‘pin’ parameter, I’ve put A0, but unable to figure out the value parameter. Please help.

The value can be any number between 0 and 255.
And the buzzer should not be connected to pin A0 since it is an output device.You can use any other pin such as 0,1,2,3,4.
In the format like below (Here I have used pin 0),

analogWrite(‘0’,0) #for no noise

analogWrite(‘0’,255) #for the maximum buzzing.

Hope you found this reply useful.

1 Like