To become familiar with the use of timers in computer applications. Specifically, to implement a piano...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
To become familiar with the use of timers in computer applications. Specifically, to implement a piano like keyboard program using the ATmega2560 timerl in Normal mode and an external speaker. Procedure: 1. Write a C program for the Arduino Mega SBC which will monitor the keyboard for inputs of A, B, C, D, E, F, and G. Depending upon which key was pressed use the timer to generate a square wave on PortB.6 of the ATmega2560 (Arduino Digital pin 12) of the appropriate frequency for the middle octave of that musical note (see Table). The note should last until another key is pressed, at which time the new note will be played. If the 'q' key is pressed the note will stop playing. For debugging purposes, use of the Arduino Serial Library is permitted for this lab. Use the file serial echo_example.ino as an example of serial I/O. YOUR C PROGRAM MUST CONTAIN A FUNCTION WHICH TAKES THE FREQUENCY AS AN INPUT, AND THEN CONFIGURES AND RUNS THE TIMER. THIS FUNCTION MUST WORK FOR ALL NOTES LISTED IN THE TABLE, IT DOES NOT HAVE TO WORK FOR ALL POSSIBLE FREQUENCIES. 2. Connect the lab speakers to PortB.6 and ground to actually play the notes so you can hear them. BE SURE TO ALWAYS DISCONNECT SBC POWER BEFORE CONNECTING OR DISCONNECTING ANYTHING ELSE TO IT. 3. Connect a sine wave signal generator to one of the lab speakers, set it to one of the musical note frequencies, and listen to it. Compare the sound of this note with the same frequency note generated from the SBC speaker. Explain why they sound different. NOTE FREQUENCY The sharp notes are included in the table for completeness. If you choose to implement all of the notes including sharps you will need to decide on an interface protocol which will distinguish between regular and sharp notes. For example, you might define regular notes as upper or lower case and sharps as the opposite. A 440 Hz A# 466 Hz B 494 Hz middle C 523 Hz C# 554 Hz D 587 Hz If you choose to implement all of the notes you will receive up to 50 points (on a scale of 100) extra credit on this lab. D# 624 Hz E 659 Hz F 698 Hz HINT: You can probably write a single subroutine which outputs the notes and checks for input. Then, you can call this single subroutine with different timer "load" values for the different F# 740 Hz 784 Hz G# 831 Hz notes. To become familiar with the use of timers in computer applications. Specifically, to implement a piano like keyboard program using the ATmega2560 timerl in Normal mode and an external speaker. Procedure: 1. Write a C program for the Arduino Mega SBC which will monitor the keyboard for inputs of A, B, C, D, E, F, and G. Depending upon which key was pressed use the timer to generate a square wave on PortB.6 of the ATmega2560 (Arduino Digital pin 12) of the appropriate frequency for the middle octave of that musical note (see Table). The note should last until another key is pressed, at which time the new note will be played. If the 'q' key is pressed the note will stop playing. For debugging purposes, use of the Arduino Serial Library is permitted for this lab. Use the file serial echo_example.ino as an example of serial I/O. YOUR C PROGRAM MUST CONTAIN A FUNCTION WHICH TAKES THE FREQUENCY AS AN INPUT, AND THEN CONFIGURES AND RUNS THE TIMER. THIS FUNCTION MUST WORK FOR ALL NOTES LISTED IN THE TABLE, IT DOES NOT HAVE TO WORK FOR ALL POSSIBLE FREQUENCIES. 2. Connect the lab speakers to PortB.6 and ground to actually play the notes so you can hear them. BE SURE TO ALWAYS DISCONNECT SBC POWER BEFORE CONNECTING OR DISCONNECTING ANYTHING ELSE TO IT. 3. Connect a sine wave signal generator to one of the lab speakers, set it to one of the musical note frequencies, and listen to it. Compare the sound of this note with the same frequency note generated from the SBC speaker. Explain why they sound different. NOTE FREQUENCY The sharp notes are included in the table for completeness. If you choose to implement all of the notes including sharps you will need to decide on an interface protocol which will distinguish between regular and sharp notes. For example, you might define regular notes as upper or lower case and sharps as the opposite. A 440 Hz A# 466 Hz B 494 Hz middle C 523 Hz C# 554 Hz D 587 Hz If you choose to implement all of the notes you will receive up to 50 points (on a scale of 100) extra credit on this lab. D# 624 Hz E 659 Hz F 698 Hz HINT: You can probably write a single subroutine which outputs the notes and checks for input. Then, you can call this single subroutine with different timer "load" values for the different F# 740 Hz 784 Hz G# 831 Hz notes.
Expert Answer:
Answer rating: 100% (QA)
Code int Spin 12 int length 11 Number of notes char notes ccggaagffeeddc a space ... View the full answer
Related Book For
Intermediate Accounting
ISBN: 978-0324592375
17th Edition
Authors: James D. Stice, Earl K. Stice, Fred Skousen
Posted Date:
Students also viewed these accounting questions
-
Continue to consider the market described in the previous problem, however make the following change. Suppose the same industry exists for an infinite number of periods, the discount factor for...
-
To help you become familiar with the accounting standards, this case is designed to take you to the FASBs Web site and have you access various publications. Access the FASBs Web site at www.fasb.org....
-
To help you become familiar with the accounting standards, this case is designed to take you to the FASBs Web site and have you access various publications. Access the FASBs Web site at www.fasb.org....
-
According to a study conducted by the Gallup organization, the proportion of Americans who are afraid to y is 0.10. A random sample of 1100 Americans results in 121 indicating that they are afraid to...
-
Assume De Beers is the sole producer of diamonds. When it wants to sell more diamonds, it must lower its price in order to induce shoppers to buy more. Further more, each additional diamond that is...
-
The following information pertains to Satellite Company: Required: Present the operating activities section of the statement of cash flows for Satellite Company using the indirectmethod. Income...
-
A proposed chemical plant has the following projected costs and revenues in millions of dollars: Using an MACRS depreciation schedule having a class life of \(5 \mathrm{yr}\), (a) Compute the cash...
-
Alan Gellen is the facilities manager for the city of Milwaukee and makes all final decisions on purchasing items such as chairs, lights, and other supplies and materials. Alan also makes the final...
-
CVP analysis is useful in examining total costs, along with fixed and variable costs. CVP analysis illuminates how changes in assumptions about cost behavior and the relevant range in which those...
-
Prove that Ki = xCi (x mi)(m mi) = 0. This fact was used in the proof that TSS = SSE + SSB on page 557.
-
What was the central belief of mercantilism? Explain
-
Cell Services Inc. (CSI) had 1,000,000 average shares outstanding during all of 2009. During 2009, CSI also had 10,000 options outstanding with exercise prices of $10 each. The average stock price of...
-
When comparing financial statements prepared under IFRS with those prepared under US GAAP, analysts may need to make adjustments related to: A. realized losses. B. unrealized gains and losses for...
-
Jordans response about the impact of Alphas decision to classify its lease as an operating lease instead of finance lease is most likely incorrect with respect to: A. net income. B. solvency and...
-
Squires & Johnson, Ltd., recorded 250,000 of depreciation expense in December 2005. The most likely effect on the companys accounting equation is: A. no effect on assets. B. a decrease in assets of...
-
A company wishing to increase earnings in the current period may choose to: A. decrease the useful life of depreciable assets. B. lower estimates of uncollectible accounts receivables. C. classify a...
-
what does p mean here. Net Asset Values 990/150 = 660p 60/150 = 40p Dividend Yield Approach 75 50/150 = 2500p 2 50/150 = 66.7p Market Values 16 150/150 = 1600p 12 2/150 = 16p
-
You are a Loan Officer with an Investment Bank. Today you need to set your lending parameters. They are: LTV: 55% 10 Year T-Bill: TBD Rate Markup: 300 Basis Points Term: 30 Years Amortization: 30...
-
Bohr Company has a credit agreement with a syndicate of banks. In order to impose some limitations on Bohrs financial riskiness, the credit agreement requires Bohr to maintain a current ratio of at...
-
The company entered into the following transactions during the year: Purchase of investment securities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . $400 Sale of investment securities . ....
-
On June 4, Seller Company signed a sales agreement with Buyer Company to deliver and install a piece of factory equipment. The total contract price is $300,000. Customers usually buy an...
-
The comparative statements of financial position of Borra Services as at 30 June 2024 and 2025 and the statement of financial performance for the year ended 30 June 2025 are shown overleaf....
-
The following comparative statements of financial position and statement of financial performance are for the business of Low Dollar Shop Pty Ltd. Additional information 1. All sales and purchases of...
-
The financial statements for the business of Autocare are shown below. Required (a) Prepare the statement of cash flows for Autocare for the year ended 30 June 2025, using the direct method. (b)...
Study smarter with the SolutionInn App