Question: CPX - Lights - and - Sound Introduction This lab uses dictionaries to hold information about musical notes and colors. It also provides continued practice
CPXLightsandSound
Introduction
This lab uses dictionaries to hold information about musical notes and colors. It also provides continued practice with using functionsand the capacitive touch pads.
Procedure
Create two global dictionaries
One to create a key:value pair for music notes and their fundamental frequency
Another to pair colors and their RGB tuple value
You may use your own values or the suggested values in the following tables
Notice there are more colors and notes than you will need
tableNoteFreqABCDEF
tableGABC
Color Red Green, Blu
black
red
green
blue
yellow
purple
cyan
white
Use an ifelifelse statement to evaluate four of the touch sensors around the board
For example, the sample code used A and A A and A would be next
When a pad is touched it should emit a note and turn on all the pixels
The note and color is up to you
Notice that you'll need to include two more touch pads
cpstarttone is used to make the sound
cpstoptone stops the sound
fillpixels is a function created to make all the pixels the same color with the color passed as a tuple from the colors dictionary
while True:Your code should include the following:The dictionaries as described aboveA function to turn on all the pixels using a the color tuple as a parameterAn ifelifelse structure to evaluate the state of at least four touch padsEach touchpad should have its own tone and color
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
