(30 pts) Write a code with helper functions that makes 4 sounds with 250 Hz, 500...
Fantastic news! We've Found the answer you've been seeking!
Question:
![(30 pts) Write a code with helper functions that makes 4 sounds with 250 Hz, 500 Hz, 750 Hz, and 1000 Hz of](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2023/09/65151f9f08557_1695883154134.jpg)
Transcribed Image Text:
(30 pts) Write a code with helper functions that makes 4 sounds with 250 Hz, 500 Hz, 750 Hz, and 1000 Hz of PWM frequency by the Cytron board's Buzzer (connected to GP18), respectively, every 1 sec (each sound lasts 0.25 sec) if you press and hold GP20 button. Also, the code should play the same 4 notes in a reverse sequence from highest to lowest frequencies every 1 sec (each sound lasts 0.25 sec) when the GP22 button is pressed. In addition to that, your code should turn on the LED of GP2 while making 250 Hz sound, the LED of GP3 while making 500 Hz sound, the LED of GP4 while making 750 Hz sound, and the LED of GP5 while making 1000 Hz sound. Moreover, nothing should happen if you press both GP20 and GP22 buttons at the same time. You SHOULD define helper functions to be called for making each sound and turning its corresponding LED on. You may need another function to be defined for turning the LEDs off when they are not needed. You can use either time.sleep() or time.ticks_ms(). Name your program playing_4notes.py. Add comments to explain how your code works. (30 pts) Write a code with helper functions that makes 4 sounds with 250 Hz, 500 Hz, 750 Hz, and 1000 Hz of PWM frequency by the Cytron board's Buzzer (connected to GP18), respectively, every 1 sec (each sound lasts 0.25 sec) if you press and hold GP20 button. Also, the code should play the same 4 notes in a reverse sequence from highest to lowest frequencies every 1 sec (each sound lasts 0.25 sec) when the GP22 button is pressed. In addition to that, your code should turn on the LED of GP2 while making 250 Hz sound, the LED of GP3 while making 500 Hz sound, the LED of GP4 while making 750 Hz sound, and the LED of GP5 while making 1000 Hz sound. Moreover, nothing should happen if you press both GP20 and GP22 buttons at the same time. You SHOULD define helper functions to be called for making each sound and turning its corresponding LED on. You may need another function to be defined for turning the LEDs off when they are not needed. You can use either time.sleep() or time.ticks_ms(). Name your program playing_4notes.py. Add comments to explain how your code works.
Expert Answer:
Answer rating: 100% (QA)
To achieve this functionality using a Cytron board you can write a Python program that utilizes the ... View the full answer
Related Book For
College Physics Reasoning and Relationships
ISBN: 978-0840058195
2nd edition
Authors: Nicholas Giordano
Posted Date:
Students also viewed these programming questions
-
Identifying and Recording Impairment Loss on Equipment Bolt Company purchased equipment on January 1, 2018, for $27,200. This equipment has an estimated useful life of five years, a residual value of...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
The Crazy Eddie fraud may appear smaller and gentler than the massive billion-dollar frauds exposed in recent times, such as Bernie Madoffs Ponzi scheme, frauds in the subprime mortgage market, the...
-
Which sets of lines can be removed without stopping the code from compiling and while printing the same output? (Choose three.) A. Lines 15 and 17 B. Lines 16 and 23 C. Lines 17, 18, and 22 D. Line...
-
1. Evaluate this statement from Intels Q1 2004 10-Q footnote disclosure (Exhibit 2): In addition, Q1 2003 benefited from the unusually high level of sales of microprocessor and chipset inventory that...
-
You are creating a chart using the data shown below. What is the best chart type and style to use in order to make the upward sales trend most obvious? A worksheet has sales data for months January...
-
What strategies distinguish the different types of food retailers?
-
The financial statements of Family News, Inc., include the following items: Requirements 1. Compute the following ratios for 2012 and 2011: a. Current ratio b. Quick (acid test) ratio c. Inventory...
-
Prepare a multiple-step incame statement. Alist Other rewenue and gains before Other openies and losses
-
Lab 2 Report ENGR 103/123- 2. Calculations/Theoretical Predictions - Potential Energy of the Spring a) Determine the Spring Constant 2 of 6 Using the fish scales provided, record the amount of force...
-
1. A consumer consumes two commodities, x and y. The consumer has utility function U (x, y) = (x - A) y and faces the budget constraint pxx + pyy = m. The shift parameter A is age. a) Find the...
-
Analysis of workforce data, performance, and engagement. Datasets: Employees Table Column Name Data Type Description employee_id Integer Unique identifier for each employee department_id Integer...
-
Discuss your observations of the Data Wrangling process. Does this exercise highlight why data wrangling and preparation can take up 60-70% of the total data analysis process? it does. How do i say...
-
Examine potential implications od regulations, legislation and standards upon decision making in a hospitality organisation, providing specific examples
-
54. .. A baton twirler in a marching band complains that her baton is defective (Figure 9-48). The manufacturer specifies that the baton should have an overall length of L = 60.0cm and a total mass...
-
New United Motor Manufacturing, Inc. was an American automobile manufacturing company in Fremont, California , jointly owned by General Motors and Toyota that opened in 1 9 8 4 and closed in 2 0 1 0...
-
Chapter 07 Homework (Application Book Show Me How LITO Perpetual Inventory The beginning Inventory of merchandise at Durne Co. and data on purchases and sales for a three-month perlod ending June 30...
-
Using the information presented in Problem 13.4B, prepare a partial statement of cash flows for the current year, showing the computation of net cash flows from operating activities using the...
-
Consider a capacitor with the same dimensions as the capacitor in Example 18.10, but now suppose there is air between the plates. What is the maximum safe operating voltage of this capacitor? That...
-
Four particles with masses m 1 = 15 kg, m 2 = 25 kg, m 3 = 10 kg, and m 4 = 20 kg sit on a very light (mass less) metal sheet and are arranged as shown in Figure P8.42. Find the moment of inertia of...
-
Figure P12.1 shows several snapshots of a wave pulse as it travels along a string. Estimate the speed of the wave pulse. Figure P12.1 ? (m) t = 0 0.2 x (m) 10 40 50 60 70 -0.2 0.2 _t = 1 s x (m) 10...
-
2. If you were the top manager at Hormel, name two organizational systems you would establish to encourage organization member creativity.
-
would ensure Hormels future success. Be sure to explain how each idea would contribute to that success.
-
3. List three creative ideas based on your TQM expertise that, if implemented,
![Mobile App Logo](https://dsd5zvtm8ll6.cloudfront.net/includes/images/mobile/finalLogo.png)
Study smarter with the SolutionInn App