In this assignment, you will increment the frequency of a piezo speaker from 20Hz to 30,000Hz. The user will push a button when they cannot hear the sound anymore and a RGB will indicate the frequency range when the button was pushed. Use your judgment to create 6 adequate ranges and use 6 different colors. This time, use the ability to change the range of the LED from 0-255 via ‘analogWrite(Pin, number)’ to create the different colors.
Frequency increments correctly (2 points)
Button indicates RGB color and displays in serial monitor (3 points)
6 ranges and 6 colors via ‘analogWrite()’ (3 points)
Commented correctly (1 point)
Code runs only once (1 point)
tone(pin, freq); // pin for piezo, freq = frequency
pinMode(pin, INPUT); //initializes button as input
A while loop will execute while a condition is true, this is very useful
LOW if pressed
HIGH if not pressed
HELP!!! I have no clue how to code. This is my project.