Pages: [1]   Go Down
Author Topic: Countdown Timer Lockbox Dilemna  (Read 790 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Code:
#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/MediaWiki/index.php?title=Doomsday_Clock_Shield#Top_Reasons_You_Need_a_Count_Down_Clock

http://www.samuraicircuits.com/merch/11-doomsday-clock-shield-kit.html

thanks guys
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 654
Posts: 50956
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
    if(_Second >= 1)
   
      noTone (buzzPin1)

    else
   
      tone(buzzPin1, 800, 1000) // this will make it beep at 800 Hz for 10 milliseconds
Semicolons on the end of statements are not just a good idea. They are MANDATORY.

This code won't even compile, let alone do nothing.
Logged

Pages: [1]   Go Up
Jump to: