I also found that a few minutes ago. The code is basically the same as I'm trying and, on my device at least, just as useless :-{ Just varying either the x or y axis gives hugely different heading results (including at 'steep' angles Nan)
Do you have a device you could try that page on ? Anybody ?