Use a variable to change your tone every 3 milliseconds (3/1000th of a second!) and see how high of a tone you can hear!
The code in the editor below already works. Just plug in your Code Speaker and press upload to see what it does! Tinker with it and make changes to see what each line of code controls.
Watch the videos for line-by-line explanation of how the example program works. Then you'll be ready to make some changes of your own!
New Concept: Variables that change, part two
This project is another example of using a variable in place of a number that changes each time the loop runs. Start thinking about how you can turn other ‘hard-coded’ numbers into variables and the creative ways they might change as your code runs. You can do any math to a variable that you can do to a number, including addition, subtraction, multiplication, and division.