Hello,
I am Hannah ^^
I am still getting used to Arduino, so please bear with me. I am working on a project for class. I am struggling with developing the code that will increment the frequency of piezo buzzer for a specific the range(20-20,000 Hz). My goal is to allow the piezo buzzer to produces sounds of increasing frequency and that each frequency has a duration of 10 ms.
So far, I know how to do this:
int piezoBuzzer = 9;
void setup()
{
Serial.begin(9600);
pinMode(piezoBuzzer, OUTPUT);
}
voidlooop()
{
tone(piezoBuzzer, 2000, 1000)
}
I am still a bit in confused on the steps I would need to take to increment the frequency such that it is producing sounds with increasing frequencies and that it does not have instances of silence in between each frequency. I am briefly familar with writing ranges in for loops:
for (int i=20; i<20,000; i++)
{
do stuff
}
But, I am struggling with how I could implement this is the piezo buzzer. Please help me and let me know what I can do?
-Hannah