Buzzer affect pin 3 and 11

I am new to Arduino, when i use buzzer while using pins 3 and 11 to output an analog signal the buzzer make the signal goes to 0 (buzzer makes pin 3 and 11 stop outputting analog signal), when i use digitalWrite(); nothing like that happens why ?

forgive me for my bad English :slight_smile:

Update: i figured out that arduino has timers in it, timers help produce sound and analog signal, pin 3 and 11 share the same timer which is timer 2, and in arduino buzzer uses timer 2 also, thats why it was working in a weird way, i thought that updating the forum will help other people :slight_smile:

2 Likes

A digitalWrite() disables the timer for that pin.

IMO it were sufficient instead to only disable the CompareOutput mode on the related channel, returning the pin to normal port operation.

This is stated in the documentation of the tone command

yep, didn't read it, guess i should give attention to the documentation more, thank you

thanks for the advice, didn't study about CompareOutput yet :slight_smile:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.