Working of a Buzzer:
ATmega 328p
/* Name : main.c
* Purpose : Source code for Buzzer Interfacing with Arduino.
* Author : Gemicates
* Date : 22-01-2018
* Website : www.gemicates.org
* Revision : None
*/
#include <Arduino.h>
const int buzzerPin = 11; // declaring the PWM pin
void setup()
{
pinMode(buzzerPin, OUTPUT); //initialize the digital pin as an Output
}
void loop()
{
digitalWrite(buzzerPin, HIGH); // switch buzzer ON by making the voltage level HIGH
delay(100); // function call for delay
digitalWrite(buzzerPin, LOW); // switch buzzer OFF by making the voltage LOW
delay(100); // function call for delay
}