Piezo Buzzer

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.

Assessment Criteria:
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)

Helpful hints:
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.


HELP!!! I have no clue how to code. This is my project.

Bad teacher.

Go through some basic examples that come with the IDE.
Flashing a LED, using a switch, etc.
Then you might have some clue what you're doing.