CMPS03 Magnetic Compass Question

Hello everybody

I have a little problem with my CMPS03.

I use an Arduino Duemilanove, and I have connected the compass like this:

This is my code, its very easy, but it doesn't work. I read the PWM signal, not the I2C...

#define out 13
#define compass 7

int input = 0;
int heading = 0;

void setup() {
  pinMode(compass, INPUT);
  pinMode(out, OUTPUT);
}

void loop() {
  input = pulseIn(compass, HIGH);    //Read Compass
  heading = (input/1000-1)*10;       //Transform into degrees
  if(heading > 180)                  //When facing west,
  {digitalWrite(out, HIGH);
  delay(100);                        //Blink for 1/10 of a second
  digitalWrite(out, LOW);
  } else {                           //When facing east,
    digitalWrite(out, HIGH);
    delay(1000);                     //Blink for 1 second
    digitalWrite(out, LOW);
  }
}

It blinks almost only in 1 second intervals.

Can somebody enlighten me? Am I using wrong numbers?
Or could the controller create a magnetic field which influeces the compass?

This site was my reference: CMPS03 documentation

Thank you very much for your help.

Even if it only briefly hits >180° it will spend ten times as long in that blink as in the shorter blinks.

Perhaps you can make it blink more often:

  {digitalWrite(out, HIGH);
  delay(heading);
  {digitalWrite(out, LOW);

You should then see the light blink fast for low azimuth angles and slower for high azimuth angles.