With my latest project my SR04 is giving veeery different read-outs, just lying next to me and looking at the wall (which has previously measured around 2.60m). I could understand the value being different but static if it is angled differently, but actually just sitting there it gives me anything from 80cm to 165cm without moving at all!
I'm pretty sure it's not a code issue, as I've tried it with an old program of mine that I know was working back then. I've triple checked the connections and made sure trig and echo are hooked up right and the pins set correctly.
The only thing that's different is that last time I was only using the SR04 and a buzzer and now I'm using an SR04, 8-dot LED matrix, a photocell and a regular red LED all off the same 5v.
Could that be effecting it? Any other ideas what I could check?
EDIT: My tired self just realized that I can check that myself by just ripping all the other components out. It DID affect it! Now all the readings are only +-1cm as expected.
So I'm gonna re-word my question then: how to I get consistent readings if I have other components draining power?