Course Solutions Uncategorized (Solved) : Modify Following Program Make Buzzer Generate 2 Different 5 Second Call Sounds 2nd Sound P Q30775176 . . . .

(Solved) : Modify Following Program Make Buzzer Generate 2 Different 5 Second Call Sounds 2nd Sound P Q30775176 . . . .

 

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. . . . .

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

(Solved) : 8 Binary Search Tree 12 10 Follow Instructions One One Construct Binary Search Tree Note Q37156168 . . . .(Solved) : 8 Binary Search Tree 12 10 Follow Instructions One One Construct Binary Search Tree Note Q37156168 . . . .

<p><img alt="8. Binary search tree (12%) a. [10%] Follow the instructions below one by one to construct a binary search tree. (Note: The c" src="https://media.cheggcdn.com/media%2F98e%2F98e8c9bb-e8ef-45e1-9e88-2af66d5c012a%2FphpC2w4ia.png" style="height:275px;width:876px;" aria-describedby="d3f"/></p>8. Binary search tree