You can read analog input with Firmata. There is some setting for the sampling time. I guess it returns average.