Hello fellow Arduino enthusiasts!
I am currently working on a gift for a buddy that is graduating soon. Basically, I would like to make a timed-lock box. Currently, my plan is to used the Doomsday Clock shield from Samurai Circuits along with their countdown library. My goal is to countdown until his day of graduation, in which a buzzer will go off letting him know that he can open his box (maybe adding a servo controlled lock later? tbd). Right now, I just want to get the buzzer working when the count reaches 0.
I've been playing with if statements and for statements to get the buzzer to work, but so far it is saying nay nay to me. As of right now, whenever I add the tone(buzzPin1, 800, 1000) in, it ignores the if or for statement and just does the buzzer while still counting down to 0. Any advice would be greatly appreciated. I have also tried a switch case statement but I (a) dont understand what the site says about them, and (b) dont know if they are even applicable in this case.
Attached is the code and the website that has everything dealing with the libraries and the shield.
#include <Doomsday.h>
Doomsday doom;
int buzzPin1 = A1;// This is the pin for the Buzzer
int _Second;
int _Minute;
int i;
void setup ()
{
doom.begin (72); // 72 ms ~~ 14 Hz
doom.setClock (05, 00, 00, 00, 00, 00);
}
void loop ()
{
static unsigned int dots = 0;
dots = (dots << 1) | !(dots & 4);
doom.secondsTick (-1);
//doom.printd ("%H:%M:%S", dots);
doom.printd ("%H%(:%)%M%(:%)%S", dots);
//doom.printd ("HE:%[L%]LO%(O%)", dots);
// this will make it beep at 800 Hz for 10 milliseconds
//tone(buzzPin1, 800, 10);
if(_Second >= 1)
noTone (buzzPin1)
else
tone(buzzPin1, 800, 1000) // this will make it beep at 800 Hz for 10 milliseconds
//tone(buzzPin1, 800, 1000);
}
http://www.samuraicircuits.com/merch/11-doomsday-clock-shield-kit.html
thanks guys