Snooze button

29 May 2012

Hey guys, I am currently trying to create a snooze button for an alarm clock. Does anyone know how i should start programming it?

30 May 2012

an mbed is relevant?

30 May 2012

You mean a snooze/alarm clock ? Have you read EA Big Ben ? very nice clock by Tom Coxon ! http://mbed.org/users/tom_coxon/programs/EA_BigBen/5yxv6

EA_BigBen Test of Embedded Artists LPCXpresso baseboard ethernet, SD card, audio and OLED display facilities. The program displays the day, date and time on the baseboard OLED and sounds the Big Ben chimes on the hour and quarter hour.

30 May 2012

Do you just want some idears ?

#define day 60*60*24
#define week 60*60*24*7
#define ALARMTIME 60+5

    printf ("\r\nRead tm Values ...\r\n");

    seconds = time (NULL);
    printf ("\r\n> Read in seconds = %d\r\n", seconds);

    t = localtime (&seconds);

    printf ("\r\n>> Current smashed time = %04d/%02d/%02d  %02d:%02d:%02d ..\r\n :)",
            (1900 + t->tm_year),
            t->tm_mon ,
            t->tm_mday,
            t->tm_hour ,
            t->tm_min,
            t->tm_sec);

// Assume 1 day or 7 day ONLY

if (seconds > week) seconds = seconds - week;

if (seconds == ALARMTIME) PlaySound();

if (SnoozeButton) ALARMTIME = ALARMTIME + SnoozeTime;

Cheers

Ceri