Frequency regulation on Buzzer

I am working on buzzer connection and have successfully done the basic operation yet the next modification I am trying is increasing the frequency of the buzzer. I tried both digital and analog function but it is hardly making any difference. Is there any other function we can use? Also what is the maximum frequency of sound can the buzzer produce?

you should not use both digitalWrite() and analogWrite() to adjust frequency, if you use both by default it chooses digitalWrite() and it sets buzzer sound to highest frequency available.
Just use analogWrite(pin,frequency) you’ll notice the change in the frequency of sound

I didn’t use analog and digital at the same time of execution. I used them in two different codes

@SiddharthBhandarkar can you share the screenshot of your code, that would make easier to find the fault

Try this.
Change the frequency in the ‘ON’ button.
Range from 0 - 255

Thank-you the code works!