2017年9月5日 星期二

Lesson 4. arduino Control Active Buzzer


In this lesson, you will learn how to generate a sound with an active buzzer.



Component Required:
(1) x Sintron Uno R3
(1) x Active buzzer
(2) x F-M wires (Female to Male DuPont wires)



Component Introduction
remember to remove sticker while using.



BUZZER:
Electronic buzzers are DC-powered and equipped with an integrated circuit. They are widely used in computers, printers, photocopiers, alarms, electronic toys, automotive electronic devices, telephones, timers and other electronic products for voice devices. Buzzers can be categorized as active and passive ones. Turn the pins of two buzzers face up. The one with a green circuit board is a passive buzzer, while the other enclosed with a black tape is an active one.
The difference between the two is that an active buzzer has a built-in oscillating
source, so it will generate a sound when electrified. A passive buzzer does not have such a source so it will not tweet if DC signals are used; instead, you need to use square waves whose frequency is between 2K and 5K to drive it. The active buzzer is often more expensive than the passive one because of multiple built-in oscillating
circuits.



Schematic 

Wiring diagram 


Wiring diagram

code ( please copy and upload sketch to arduino board )
Everything between /* and */ or after // is a block comment; it explains what the sketch is for. 


//by Sintron
//2017.03.20


const int buzzer = 12; //buzzer to arduino pin 12


void setup(){

  pinMode(buzzer, OUTPUT); // Set buzzer - pin 12 as an output

}

void loop(){

  tone(buzzer, 1000); // Send 1KHz sound signal...
  delay(1000);        // ...for 1 sec
  noTone(buzzer);     // Stop sound...
  delay(1000);        // ...for 1sec

}


Share:

0 意見:

張貼留言

Sintron

Search This Blog

技術提供:Blogger.

Blog Archive

Arduino Super Mario tone with Buzzer