Well, the fact that it only differs by a bit each time sounds good. It's a 24 bit number, so could give you anything up to 24 million. The fact it's 169k probably means it's basically unloaded.
I'd experiment by putting different stresses on it and seeing how it changes.
Also, 338642 / 2 = 169321 - so it seems like the digitalPulse code might be working too, although maybe you're reading one too many bits, which is pushing the value up. Personally I'd avoid digitalPulse though because the async-ness of it might make it less reliable. The SPI method is quite efficient too.
© Espruino, powered by microcosm.
Report a problem