Fluidic device with pumping and sensing functions for precise flow control