Wireless Vibration Alarm Clock

Hi all,

I'm working on a project for school involving an alarm clock and a vibration module, much like the one used with this clock: http://www.amazon.com/Sonic-Alert-SB200ss-Alarm-Clock/dp/B000EX7LNM

The setup is as follows:

A wire would be spliced into the positive wire connected to the alarm buzzer in the main clock and connected to an Arduino Duemilanove in pin 3 as an "INPUT_PIN".

When the alarm activates, the Arduino would recognize the pin as a HIGH voltage and transmit serial data through an RF transmitter, specifically this: http://www.sparkfun.com/products/10534

On the other end, a receiver, http://www.sparkfun.com/products/10532, connected to a Lilypad Arduino ATMEGA 328 would receive the serial data

The Lilypad would interpret the serial data and output a voltage on a specific pin to activate a transistor which would complete the circuit for the vibration motor to activate.

End. This is a basic layout of what should occur from the coding, however, I am very new to Arduino coding and would like someone knowledgeable to verify my code.


This would be the code for the Arduino Duemilanove

#define INPUT_PIN 3

void setup()
{
  Serial.begin(1200);
}

void loop()
{
Serial.write(45);
    if (digitalRead(INPUT_PIN) == HIGH)
    {
    int bytesSent = Serial.write("A");
    }
    if (digitalRead(INPUT_PIN) == LOW);
    {
    int bytesSent = Serial.write("B");
    }
}

This code would be for the LilyPad (ledpin signifies the output pin to the transistor)

#define receiver

int incomingByte = 0;
int ledpin = 3;

void setup()
{
  pinMode(ledpin, OUTPUT);
  Serial.begin(1200);
}

void loop()
{
  if(Serial.read() == 'A')
  {
    digitalWrite(ledpin, HIGH);
  }
  if(Serial.read() != 'A')
  {
    digitalWrite(ledpin, LOW);
  }
}

Can anyone verify if this code is feasible for working? Also, would there be a way to sleep the lilypad and have it wake every 30 seconds to read serial data?

Thank you in advance!