Home / Expert Answers / Computer Science / homework-2-programming-the-pico-use-the-homework-template-file-for-your-homework-responses-or-org-pa820

(Solved): Homework #2: Programming the Pico Use the Homework Template file for your homework responses (or org ...



Homework #2: Programming the Pico Use the Homework Template file for your homework responses (or organize whatever you write your answers on like the template). Don't forget to fill out the cover sheet completely including header and footer. Make sure that you show how you arrive at any answers involving numerical calculations. Answers that do not show intermediate steps will likely not earn many, if any, points. Copy and paste additional table cells as needed.

(20pts)

Use the time.ticks_ms() construct that we covered in lecture (in other words, no use of time.sleep() ), and write a program to blink the LED on the Pico like a heartbeat: 50 ms on and 1 sec off. Call your program heartbeat. py. Add comments to explain how your code works. ( 30 pts ) Write a code with helper functions that makes 4 sounds with

250Hz,500Hz

, 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. The result of your code should be similar to the one demonstrated in the attached video.

student submitted image, transcription available below


We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe