This question already has an answer here:



void setup() // Built in initialization block  

void loop() // Main loop auto-repeats


//   Serial.println("Beep!");

   tone(4, 3000, 1000); // Play tone for 1 second

   delay(1000); // Delay to finish tone    

marked as duplicate by Majenko, Gerben, Greenonline, Enric Blanco, Michel Keijzers Jun 3 '17 at 22:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Does this buzzer work when voltage is applied to it directly? If so, then have you tried just turning it on with an output pin and then delaying while it buzzes? Is it really a buzzer, or is it a piezo transducer? I see a statement of the problem in the title, then a code snippet which is obviously your attempt to make it work, but I do not see a question. Plus, as @Majenko and Delta_G point out, there are other questions that may answer this. So I suggest you do some more research on this before posting. This will need to explain why it is not a duplicate, at the very least. – SDsolar Jun 3 '17 at 16:47
  • This question is no longer a duplicate. The OP had an original question, arduino.stackexchange.com/questions/39087/…, which was answered. Then they (incorrectly) modified that original question, to be the same as the original answer. Obviously they should not have done that. Then, they asked the same modified question again here, thereby making a duplicate of the original question (after it had been modified). Now that I have rolled back the original question, this question is no longer a duplicate, and as such should be reopened. – Greenonline Jun 3 '17 at 23:34

First, take a look at the two links provided in the comments to your question and explain why your question is different from them. Start by describing your "buzzer." If your question is not significantly different then it will attract downvotes instead of answers, or it may be marked as duplicate or just simply closed.

Here is one solution, making the assumption you are writing about a piezo beeper:

void setup() {
void loop() {

Alternatively, take the first example program from your IDE, called blink, and hook your beeper to pin 13 (positive) and GND (negative) while that runs. It does basically the same thing.

  • The two links go to the same question, that the OP has already asked... The problem is probably active/passive buzzer – Greenonline Jun 3 '17 at 17:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.