Hi, I am using an Arduino Uno with a simple circuit, where pin 9 is connected to a buzzer and then to the ground. I have the following script to make it sound:
const float c = 0.26163;
void setup() {
pinMode(9,OUTPUT);
}
void loop() {
play(1.5);
}
void play(double pitch) {
digitalWrite(9,HIGH);
delay(pitch);
digitalWrite(9,LOW);
delay(pitch);
}
If i play with pitch as 1.5ms, it makes the exact same pitch as 1ms, can someone explain why, and how i would fix this?
Thanks!