Tuesday, 5 January 2010


My circuit design needs to be able to contain 3 buttons: one to activate the alarm, snooze and turn off like all basic alarm clocks. (I'm hoping to merge my alarm activation with my off button so fewer is needed.)

Before the holidays broke up, I found myself launching straight into combining a button into my real time clock. This was unsuccessful. A button you might think, and what i thought, would be relatively simple to add is not! When i added my button, it stopped my clock counter- so stopped my clock from working. This was bad! I need my clock to always be on regardless of external factors.

I decided that i would strip back to basics and build on the 'button' example provided by arduino without my real time clock. This could then be transferred back into my real time clock with a higher understanding of this particular set of codes.

This was actually relatively straight forward to do without using the clock, once of course i knew what to do;

Difficulty 1: planning what i would need and what i wanted to be the outcome. I drew myself a systems diagram to help break this down and order my actions. This would act like a guide for writing my code.

Difficulty 2: translating my systems diagram into Arduino code. The difficulty is to include all the loops. (I knew how to do one loop) This was a problem as i have 5 small loops in 1 big loop. I knew how i could complete this in 'P BASIC', a different programming software. As arduino is knew to me, i did not know what could or could not be manipulated. I did follow my P BASIC knowledge to overcome this. I found that i could use IF ELSE statements with lots of little loops in one big loops, solving my multiple loop crises!

Difficulty 3: Circuit building. I am just going to say it...i'm crap at making a working circuit! Just take a loop at this;

Difficulty 4: Testing.It took some time to realise that within my one big 'IF' statement with 5 smaller ones that i had added an extra '}' which closed my big loop and made 6 smaller loops...it now works hours later!!

My next step is start placing the button loops in my real time clock code.

No comments:

Post a Comment