Lilypad + Bluesmirf serial communication with PC

Hi, I'm a beginner who's working hard on figuring out how to connect my sensors(Accelerometer ADXL335 in this example) + Lilypad(or Arduino Uno) with PC(windows 7). (I have successfully connected this accelerometer with PC via Arduino Uno with the same code)

Here's the code I've copied from Arduino's tutorial:

// these constants describe the pins. They won't change:
const int groundpin = 18;// analog input pin 4 -- ground
const int powerpin = 19;              // analog input pin 5 -- voltage
const int xpin = A3;                  // x-axis of the accelerometer
const int ypin = A2;                  // y-axis
const int zpin = A1;                  // z-axis (only on 3-axis models)

void setup()
  Serial.begin(9600);    // initialize the serial communications:
  // Provide ground and power by using the analog inputs as normal
  // digital pins.  This makes it possible to directly connect the
  // breakout board to the Arduino.  If you use the normal 5V and
  // GND pins on the Arduino, you can remove these lines.
  pinMode(groundpin, OUTPUT);
  pinMode(powerpin, OUTPUT);
  digitalWrite(groundpin, LOW);
  digitalWrite(powerpin, HIGH);

void loop()
  Serial.print(analogRead(xpin));    // print the sensor values:
  Serial.print("\t");    // print a tab between values:
  Serial.print(analogRead(ypin));    // print a tab between values:
  delay(100);    // delay before next reading:

So what I did is get my laptop to connect this "device" in this image via bluetooth, after it's connected to the right COM (COM6), go to "Arduino software", compile and upload this code to COM6. (yes this same code succeeded when I connect the accelerometer to Arduino Uno directly)

However, everytime I do this, the green flash on Bluesmirf BT module turns on(i.e. connected) for few seconds and then turns back to red flash(on but disconnected), I'm pretty sure it's not Bluesmirf's fault as I tried another Bluesmirf and the same thing happens, your help is very much appreciated!!! (in case you wonder, I get these devices from someone else)

I was working on the same thing but with different board. I found out that you must set baudrate on bluesmirf and bluetooth com port on pc to the upload speed of your board. For lilypad328 set baudrate to 57600 and for lilypad168 set it to 19200. and you also have to manually reset the board like with older Arduinos. Press reset button and hold it down while holding press upload and you have to release reset button just before the green light on Bluesmirf goes on Right now I'm trying to figure out how to do reset automaticly