I have difficulties id using tone function.
unsigned long durations = 1000;
int frequency=3000;
int buzzPin= D1;
void setup() {
Serial.begin(115200);
pinMode(buzzPin, OUTPUT);
}
void loop(){
tone(buzzPin, frequency, durations);
delay(1000);
noTone(buzzPin);
}
when I put delay(1000); it works fine but the durations value doesn't work.
on top of that if I delete delay(1000); tone function does not work.
What did I do wrong?