Modify the following program to make the buzzer generate2 different 5 second call sounds. The 2nd sound should be produced20 seconds after the first. An Arduino mega 2560 board is used asthe micro-controller to connect the buzzer. Must employ Cprogramming language and must NOT use any Ardiunofunctions.
//Buzzer I/O signal is connected to PIN 5
int tune1[]={10,15,80,55,122,177};
int dur1[]={50,70,90,110,130,150};
int i,j,n=6; //n is inialitsed to the number o fnotes in tune1.
int tmp;
void setup() {
DDRE = (1<<DDE3);
TCCR3A = (1<<COM3A1)|(1<<WGM31);
TCCR3B =(1<<WGM33)|(1<<WGM32)|(1<<CS32);
}
void loop() {
buzzer();
_delay_ms(3000);
}
void buzzer() {
for (i=0;i<n;i++){
ICR3=tune1[i];
OCR3A=tune1[i]/2;
TCNT3=0;
for (j=0;j<dur1[i];j++){_delay_ms(1);}
}
ICR3=0;OCR3A=0;TCNT3=0;
}
Expert Answer
An answer will be send to you shortly. . . . .