Alarm clock with music and lamp dimmer function

Hi all,

I am new to the electronics world, but I have always wanted to build something from scratch on a PIC. So I decided to design an alarm clock from scratch that controls both a lamp dimmer and music for the alarm. I have been working on it for months, but I have now got it to a state that I am happy with. It seems to be working fine. I wanted to post my code and layout of the hardware to get feedback from the arduino community in terms of areas that I could improve with the code. It would be great to hear everyones ideas, and what could be improved. Of course, if anyone wants to use the code and/or hardware lay out, they are more than welcome. The code is attached (in two parts, one for the master ATmega, which controls pretty much everything, and one slave ATmega, which controls the lamp dimming functions), and the hardware layout is attached after that.


P.S. this project works with mains electricity. Please only use these plans if you are safe enough to do so