So first off, I'm trying to make an alarm clock that looks like the bomb from CS:GO. Everything is done except the buzzer/beeping/code part. The problem is the buzzer (Which I believe is active, but not sure since the marketing says active, but I can change the pitch) doesn't stop at the delay() command. Here's the test code I found online:
static const int buzzerPin = 13; // set the variable "buzzerPin" to pin 13
void setup(void) {
pinMode(buzzerPin, OUTPUT); // set the buzzerPin as output
}
void loop() {
beep(); // execute the "beep" function
delay(1000); // pause 5s
}
void beep() {
tone(buzzerPin, 196, 100); // give a tone on the buzzerPin, at 196hz for, 200ms
}
The tone() turns off with delay() command, but the default 2KHz tone of the buzzer continues to pierce my ears. How do I stop the default tone from playing in between beeps? Even noTone() doesn't stop the default buzzing frequency.
I've connected the buzzer to 5v, GND and pin d13 (UNO)
This is how the whole alarm clock is connected. I don't have a resistor between the buzzer and the power. The buzzer I'm using is TMB12A05
