BUZZER
• Piezo buzzer is an electronic device commonly used to
produce sound.
• Light weight, simple construction and low price make
it usable in various applications like car/truck reversing
indicator, computers, call bells etc.
• Piezo buzzer is based on the inverse principle of piezo
electricity . It is the phenomena of generating
electricity when mechanical pressure is applied to
certain materials and the vice versa is also true. Such
materials are called piezo electric materials.
• Piezo electric materials are either naturally available or
manmade. Piezoceramic is class of manmade material,
which poses piezo electric effect and is widely used to
make disc, the heart of piezo buzzer. When subjected
to an alternating electric field they stretch or
compress, in accordance with the frequency of the
signal thereby producing sound.
CODE
const int buzzer = 9; //buzzer to arduino pin 9
void setup()
{
pinMode(buzzer, OUTPUT); // initializing pin 9 as an output
}
void loop()
{
digitalWrite(buzzer, HIGH); // (HIGH )
delay(1000); // wait for a second
digitalWrite(buzzer, LOW); // LOW
delay(1000); // wait for a second
}
int ledPin = 13;
int knockSensor = A0;
byte val = 0;
int statePin = LOW;
int THRESHOLD = 70;
void setup() {
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
val = analogRead(knockSensor);
if (val >= THRESHOLD) {
statePin = !statePin;
digitalWrite(ledPin, statePin);
Serial.println("Knock!");
}
delay(100); // we have to make a delay to avoid overloading
}
KNOCK

Buzzer

  • 1.
  • 2.
    • Piezo buzzeris an electronic device commonly used to produce sound. • Light weight, simple construction and low price make it usable in various applications like car/truck reversing indicator, computers, call bells etc. • Piezo buzzer is based on the inverse principle of piezo electricity . It is the phenomena of generating electricity when mechanical pressure is applied to certain materials and the vice versa is also true. Such materials are called piezo electric materials. • Piezo electric materials are either naturally available or manmade. Piezoceramic is class of manmade material, which poses piezo electric effect and is widely used to make disc, the heart of piezo buzzer. When subjected to an alternating electric field they stretch or compress, in accordance with the frequency of the signal thereby producing sound.
  • 4.
    CODE const int buzzer= 9; //buzzer to arduino pin 9 void setup() { pinMode(buzzer, OUTPUT); // initializing pin 9 as an output } void loop() { digitalWrite(buzzer, HIGH); // (HIGH ) delay(1000); // wait for a second digitalWrite(buzzer, LOW); // LOW delay(1000); // wait for a second }
  • 5.
    int ledPin =13; int knockSensor = A0; byte val = 0; int statePin = LOW; int THRESHOLD = 70; void setup() { pinMode(ledPin, OUTPUT); Serial.begin(9600); } void loop() { val = analogRead(knockSensor); if (val >= THRESHOLD) { statePin = !statePin; digitalWrite(ledPin, statePin); Serial.println("Knock!"); } delay(100); // we have to make a delay to avoid overloading } KNOCK