Sunday, September 20, 2009

An overly elaborate alarm clock

The mid-semester break has just started, and I thought I'd celebrate my 2 weeks of freedom by creating a pointlessly elaborate alarm clock.

The problem: I can't get up in the morning. I don't have an alarm clock, and I'm too cheap/lazy to buy one.

Solution: Write an alarm clock program to run on my desktop.

I use 2 Dell 24" 2408WFP LCDs as part of my desktop - which sits opposite my bed. So I decided to make an alarm clock out of them.

First thing's first: turning on my PC. Every night I put my desktop to sleep, since it's far more convenient than shutting it down. Luckily, Windows Vista's task scheduler allows for waking the computer from sleep in order to run scheduled tasks. Perfect!

Next, the alarm clock program. Using task scheduler, it's set to run every morning at the pre-set time. Once the computer wakes and the program runs, this is what I'm presented with:



On the left monitor I have a big polar clock, which I shamelessly stole from pixelbreaker.com. Although the idea belongs to someone else, this implementation is my own. On the right monitor I have some daily weather information pulled directly from the Bureau of Meteorology's data feeds. When getting dressed in the morning it always helps to know the current weather forecasts for the day.

When the program starts, it starts playing music (from my music collection) to wake me up. It also makes sure to set the system master volume automatically to make sure it's loud enough to get be out of bed.

The program was written in C# using XNA Game Studio 3.1. What a way to waste a weekend. :)