Turn a potentiometer to change the pitch, mapping the reading up to 1500 hertz.
This tutorial is part of the Nairda learning path. You can build it step by step inside the app, which checks every block you place before letting you move on.
The steps
- We add a While loop, which repeats forever.
- We declare a frequency called buzzer on pin 9.
- We declare a potentiometer called pot on analog pin 0.
- We create a number variable called reading.
- Inside the loop we set reading to what the pot measures.
- Behind it we put the buzzer with a Map block in its hertz.
- We map the variable reading from 0 to 100 into 0 to 1500 hertz.
When you finish, the app takes you straight to the next tutorial in the path.