Question: Using programming language C++ and IF statements, can you help generate a code to make this work on a MBED? Thank you! For this assignment

 Using programming language C++ and IF statements, can you help generate
Using programming language C++ and IF statements, can you help generate a code to make this work on a MBED? Thank you!

For this assignment you will use the mbed with its Digitalin and PwmOut objects to implement a simple musical instrument. Connect 4 pushbutton switches in active-high configuration to pins p5 through p8 of the mbed. Connect the piezo transducer between pin p21 and GND Pressing a switch should generate a particular musical note on the piezo transducer (at maximum volume) and light up a particular LED (at full brightness). When the switch is released, the note should fade out over a 0.1 second period with both the brightness of the LED and the volume of the piezo transducer perceptibly diminishing over time rather than immediately stopping. The following table shows the frequencies for the notes as well as the LED that should light up for each note Switch pin Frequency LED (Hz) 1046 1175 1319 1397 LED1 LED2 LED3 LED4 p6 p8 The piezo transducer will output a note at maximum value when the PWM duty cycle is set to 50% and at reduced volume as the duty cycle approaches either 0% or 100%. Note however that this extremely non- linear, so differences in volume will only be noticeable at the extremes (approximately 096-396 or 97% 100%)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!