Hello, I am looking for coding advice and example code of possible.
I want to measure the muzzle velocity of an air rifle. I have optical sensors that change state low to high when interrupted. Set of 2 pair of light source and detector each trap 6" apart. This part is not the issue. I want to use a rp2040 pi pico. Fro
m reading around the net, the micros doesn't return a decent accuracy. Not sure if this is true or not. I want to measure 6" of travel at 1500 ft/s. It should be sufficient using micros. Is there a better way of getting high accuracy and repeatability in the code?
It is no problem to time an event of duration 333 usec to about 1% accuracy using the micros() function, and if higher accuracy is required, there are much better and faster approaches to event timing.
The real problem will be obtaining a clean, fast transitioning signal from the two optical gates, as the pellet passes through them. So solve that first.
without additional hardware, i don't believe using a processor running on OS will be able to respond quickly to an I/O event. you'd be better of with an Arduino