working on Accelerometer Memsic 2125

..I'd like to expand on the example.

I have the Memsic and working nicely as described.

What I want to get is an X + Y tilt value from that.
Actually to tilt from 0 - 90 degrees on one axis and give an output of 1 - 1000 something like that,
which would be actually for passing to a digitalWrite to control an LED by PWM.

I see some examples in BASIC here but I can't figure it out.
http://www.parallax.com/dl/docs/prod/compshop/SICMemsicTut.pdf

I also found interesting to use this code using pulseIn.

/*
Lire le retour de l'accelerometre avec la fonction pulseIn intégré
*/

int xPin = 7;      //  x-axis input
int yPin = 6;      //  y-axis input

unsigned long xDuration;
unsigned long yDuration;

void setup() {
  beginSerial(9600);
  pinMode(xPin, INPUT);
  pinMode(yPin, INPUT);
}

void loop(){
  
  yDuration = pulseIn(yPin, HIGH);
  xDuration = pulseIn(xPin, HIGH);
  
  serialWrite('Y');
  serialWrite('-');
  printInteger(yDuration);
  printByte(10);
 
  serialWrite('X');
  serialWrite('-');
  printInteger(xDuration);
  printByte(10);
  
}

It was from another forum post, yes in French!! - at least I could understand that - and works pretty good, cant seem to find the page now.

Any help greatly appreciated,

cheers,

Jim