Closed
Description
This code wouldn't make a sound on a regular piezo, nor make a signal on the oscilloscope
void setup() {
pinMode(6, OUTPUT);
}
void loop() {
delay(1000);
tone(6,600);
delay(100);
noTone(6);
}
While this code does work:
void setup() {
pinMode(6, OUTPUT);
}
void loop() {
tone(6,600);
delay(100);
noTone(6);
delay(1000);
}
This code also works:
void setup() {
pinMode(6, OUTPUT);
}
void loop() {
delay(1000);
tone(6,600);
tone(6,600);
delay(100);
noTone(6);
}
Would there be a way to fix it in the https://github.com/arduino/ArduinoCore-megaavr/blob/master/cores/arduino/Tone.cpp file? It seems like delay(x) leaves some timer in a state that tone can't deal with. Other functions like delayMicroseconds() seem to work with tone without any problems...
I use version 1.6.24 in the board manager, tried different Arduino UNO Wifi's and selecting ATMEGA328 register emulation doesn't influence the problem.
Metadata
Metadata
Assignees
Labels
No labels