Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(30 pts) Write a code with helper functions that makes 4 sounds with 250 Hz, 500 Hz, 750 Hz, and 1000 Hz of PWM

(30 pts) Write a code with helper functions that makes 4 sounds with 250 Hz, 500 Hz, 750 Hz, and 1000 Hz of

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

Step by Step Solution

3.27 Rating (133 Votes )

There are 3 Steps involved in it

Step: 1

To achieve this functionality using a Cytron board you can write a Python program that utilizes the ... blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

College Physics Reasoning and Relationships

Authors: Nicholas Giordano

2nd edition

840058195, 9781285225340 , 978-0840058195

More Books

Students also viewed these Programming questions

Question

=+b) Create a p chart for these samples.

Answered: 1 week ago