First-Time Arduino User; help with coding alarm clock.

Hello,

I build clocks as a hobby. I'd like to use an Arduino UNO in my next clock, but I am completely new to both C++ and Arduino itself.

Things I'd like to have the Arduino perform (in order):

  • keep track of time
  • detect alarm time
  • create noise via loudspeaker
  • read input from keyboard
  • display inputs on 16x2 LCD screen
  • if inputs from keyboard match a specified string of numbers (4, 8, 15, 16, 23, 42), stop noise and clear screen.
  • loop the entire process, so that it occurs at a set time every 24 hours.

I've read and watched a few tutorials, and i've managed to come up with some pseudo-code, but I am still confused as to how to implement it, or what hardware I would need.

if (current time == alarm time)
{
   set alarm ON;
}
...
if (alarm is ON)
{
       read keyboard characters into buffer;
       if (the buffer contains expected string)
       {
            set alarm OFF;
            empty the buffer;
        }
}

I know that I'm missing about 80% of what I need to make this work, but I'm willing to learn, if I can be set in the right direction.

(but, if you just wanted to write out a full sketch for the project, that would be cool too)

Things I'd like to have the Arduino perform (in order):

  • keep track of time

By itself, it does a relatively lousy job of this. An RTC is cheap and easy to read.

  • detect alarm time

How? Do you mean that you want it to detect that is it time to raise an alarm? That's something quite different, and easy to do.

  • create noise via loudspeaker

That is a hardware issue, not a software issue.

  • read input from keyboard

Take a quick peak at your Arduino. See a keyboard? None of mine have keyboards.

  • display inputs on 16x2 LCD screen

An LCD is an output device. Of course, you can output anything you want to it - including what you got as input from another device.

Here's my alarm clock project:

No keyboard.

I like clocks as well (and also Lost). I'd suggest not trying to eat the whole elephant in one bite. Using a real-time clock (RTC) is a good suggestion. Get one, learn to set it, read it, etc. ... that's one bite. Making noise, reading a keyboard, driving an LCD are others. Approach them as individual mini-projects, conquer each device then they can be combined. Definitely read up on C/C++ if that's new to you. Google around, there are plenty of tutorials online. Just diddle around with some simple Arduino projects (just one example) to get a feel for what the thing can do. This will also be programming practice. There's a learning curve, take it one small step at a time and it should be a lot of fun.

Ask questions, pick the right board to post on, give enough background, code, wiring diagrams (schematics), etc. so folks can understand what you're trying to do, what you've tried, how it didn't work, etc.